- 执行命令更新、查看版本
sudo gem update --system
sudo gem install cocoapods
pod setup
pod --version
输入命令sudo gem install cocoapods --pre
升级
此时会报错
hideOnBush:UAV_iOS Theshy$ sudo gem install cocoapods --pre
Fetching: cocoapods-core-1.1.0.beta.2.gem (100%)
Successfully installed cocoapods-core-1.1.0.beta.2
Fetching: cocoapods-deintegrate-1.0.1.gem (100%)
Successfully installed cocoapods-deintegrate-1.0.1
Fetching: cocoapods-downloader-1.1.1.gem (100%)
Successfully installed cocoapods-downloader-1.1.1
Fetching: cocoapods-try-1.1.0.gem (100%)
Successfully installed cocoapods-try-1.1.0
Fetching: molinillo-0.5.0.gem (100%)
Successfully installed molinillo-0.5.0
Fetching: xcodeproj-1.3.0.gem (100%)
ERROR: While executing gem ... (Errno::EPERM)
Operation not permitted - /usr/bin/xcodeproj
hideOnBush:UAV_iOS Theshy$ sudo gem install cocoapods --pre /usr/local/bin cocoapods
ERROR: While executing gem ... (Errno::EPERM)
Operation not permitted - /usr/bin/xcodeproj
原因
Cocoapods在10.11系统上发生了变化
stack overflow上的解释是这样的
This is happening because Apple has enabled rootless on the new install
也就是说在10.11系统上苹果已经启用无根的安装
在这种情况下,如果你使用如下的命令:
sudo gem install cocoa pods
就会出现这样的提示:
ERROR: While executing gem ... (Errno::EPERM) Operation not permitted - /usr/bin/pod
此时我们输入命令
sudo gem install cocoapods --pre -n /usr/local/bin cocoa pods
就能正确升级成功
降级cocopods
执行sudo gem uninstall cocoapods
卸载现有 cocopods
安装
sudo gem install cocoapods -v 0.39.0
若是报错
ERROR: While executing gem ... (Errno::EPERM)
Operation not permitted - /usr/bin/pod
执行命令sudo gem install cocoapods -v 0.39.0 -n /usr/local/bin
则下载成功 0.39版本