CocoaPods 版本升级

有时我们使用命令执行pod安装时,会提示:

[!] The version of CocoaPods used to generate the lockfile (1.2.0) is higher than the version of the current executable (1.0.1). Incompatibility issues may arise.

这时,我们确实是需要升级我们的pods了,不然我们无法继续进行后续的工作。

使用命令行来升级我们的CocoaPods
$ sudo gem update --system // 先更新gem,国内需要切换源
$ gem sources --remove https://rubygems.org/
$ gem sources -a https://ruby.taobao.org/
$ gem sources -l
\*\*\* CURRENT SOURCES \*\*\*
https://ruby.taobao.org/
$ sudo gem install cocoapods // 安装cocoapods
$ pod setup

我们使用sudo gem install cocoapods命令来进行安装CocoaPods时,在OS X 10.11 以后的系统会出现如下错误:

Updating rubygems-update
ERROR:  While executing gem ... (Errno::EPERM)
    Operation not permitted - /usr/bin/update_rubygems

参考下面方法解决

http://stackoverflow.com/questions/30812777/cannot-install-cocoa-pods-after-uninstalling-results-in-error/30851030#30851030/

sudo gem install -n /usr/local/bin cocoapods

Done !