1.替换ruby更新源.
gem sources --remove https://rubygems.org/
gem sources -a https://ruby.taobao.org/
注意:是https,不是http
2.验证更新是否成功.
gem sources -l
*** CURRENT SOURCES ***
https://ruby.taobao.org/
3.更新ruby环境
sudo gem update --system
4.安装cocoa pod
sudo gem install cocoapods
笔者遇到错误.
ERROR:While executing gem ... (Errno::EPERM)
Operation not permitted - /usr/bin/pod
后经查论坛改用:
sudo gem install -n /usr/local/bin cocoapods
5.安装成功后,命令行下执行
pod search afn
仍然command not found.查实/usr/local/bin/下确实有pod文件.于是通过编辑~/.bash_profile,添加
export PATH=/usr/local/bin:$PATH
终于cocoapods正常使用.
20151024更新.
pod install --verbose --no-repo-update
pod update --verbose --no-repo-update