1. 配置 ruby 环境
a. gem sources –l // 查看ruby源
b. gem sources --remove https://rubygems.org/ // 删除ruby源
c. gem sources -a https://gems.ruby-china.com/ // 添加ruby源
注意最新的 ruby 源已改为https://gems.ruby-china.com
2. 安装 CocoaPods
a. 安装 CocoaPods 之前,如果 gem 版本太老,需要升级gem:
b.更新 gem sudo gem update --system
c.查看gem版本 gem -v
然后漫长等待更新...
更新成功!
1>如果升级CocoaPods遇到 ERROR: While executing gem ... (TypeError) no implicit conversion of nil into String
先更新 Ruby
sudo gem update --system
2>安装cocoapods时候提示
tiantaodeMacBook-Pro:~ tiantao$ sudo gem install cocoapods
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /usr/bin directory.
解决方案 有人说 前面加sudo 明明已经加了 是无写入到/usr/bin directory 权限
执行此命令即可
sudo gem install cocoapods -n /usr/local/bin
done!