1. 程式人生 > >OS X 10.11 安裝Cocoapods 出現問題的解決方法,10.11cocoapods

OS X 10.11 安裝Cocoapods 出現問題的解決方法,10.11cocoapods

今天嘗試用 Cocoapods安裝個第三方庫.. 輸入pod install, 發現 command not find。 WTF! 
估計是升級10.11後Cocoapods被幹掉了。 
我輸入 sudo gem install cocoa pods 之後,出現如下問題: 
ERROR:  While executing gem ... (Gem::DependencyError)    Unable to resolve dependencies: cocoapods requires cocoapods-core (= 0.33.1), claide (~> 0.6.1), cocoapods-downloader (~> 0.6.1), cocoapods-plugins (~> 0.2.0), cocoapods-try (~> 0.3.0), cocoapods-trunk (~> 0.1.1), nap (~> 0.7)
解決方法:sudo gem update --system但是出現了另一個錯誤:ERROR:  While executing gem ... (Errno::EPERM)    Operation not permitted - /usr/bin/xcodeproj在Stackoverflow上找到了解決方法:在終端中輸入:sudo nvram boot-args="rootless=0"; sudo reboot然後你的電腦會重啟之後再輸入 sudo gem install cocoapods -V 就可以了不放心的話輸入 pod --version0.37.2 //顯示出版本就說明成功了但是之後我pod install的時候又花式出錯

[!] Unable to add a source with url `https://github.com/CocoaPods/Specs.git` named `master`.

You can try adding it manually in `~/.cocoapods/repos` or via `pod repo add`.


我嘗試按提示的方法

pod repo add master https://github.com/CocoaPods/Specs.git


然而還是有錯..

[!] /usr/bin/git clone http://git.oschina.net/akuandev/Specs.git master

xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun


最後的解決方法:

sudo xcode-select -switch /Applications/Xcode-beta.app/Contents/Developers


後面的地址你可以開啟Xcode顯示包內容,找到那個資料夾拖到終端裡面比較不容易錯。

CocoaPods 0.38.0.beta.2 is available.

To update use: `gem install cocoapods --pre`

[!] This is a test version we'd love you to try.

For more information see http://blog.cocoapods.org

and the CHANGELOG for this version http://git.io/BaH8pQ.

CocoaPods 0.38.0.beta.2 is available.

To update use: `gem install cocoapods --pre`

[!] This is a test version we'd love you to try.

For more information see http://blog.cocoapods.org

and the CHANGELOG for this version http://git.io/BaH8pQ.

最後終於修成正果.. 至於一開始輸入 sudo gem install cocoapods 沒反應需要修改為淘寶映象的問題,請百度Cocoapods參閱其它文章..