- 執(zhí)行命令更新、查看版本
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系統(tǒng)上發(fā)生了變化
stack overflow上的解釋是這樣的
This is happening because Apple has enabled rootless on the new install
也就是說在10.11系統(tǒng)上蘋果已經(jīng)啟用無根的安裝
在這種情況下,如果你使用如下的命令:
sudo gem install cocoa pods
就會出現(xiàn)這樣的提示:
ERROR: While executing gem ... (Errno::EPERM) Operation not permitted - /usr/bin/pod
此時我們輸入命令
sudo gem install cocoapods --pre -n /usr/local/bin cocoa pods
就能正確升級成功
降級cocopods
執(zhí)行sudo gem uninstall cocoapods
卸載現(xiàn)有 cocopods
安裝
sudo gem install cocoapods -v 0.39.0
若是報錯
ERROR: While executing gem ... (Errno::EPERM)
Operation not permitted - /usr/bin/pod
執(zhí)行命令sudo gem install cocoapods -v 0.39.0 -n /usr/local/bin
則下載成功 0.39版本
install