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
20160425更新
sudo gem install -n /usr/local/bin cocoapods --pre
20161126更新
swift3.0出来那会,有些第三方没能及时跟上. 从那个时候决定,第三方包统一源码编译. 管他cocoapod 或者 cartfile. 但愿能撑到官方SPM支持IOS的时候.