pod setup出錯的解決辦法
阿新 • • 發佈:2018-11-21
轉載自轉載自:
https://www.jianshu.com/p/f25f07234b25
我們在安裝cocoapods時,pod setup時出錯
錯誤情況一:
$ pod setup Setting up CocoaPods master repo [!] /usr/bin/git clone [https://github.com/CocoaPods/Specs.git](https://github.com/CocoaPods/Specs.git) master Cloning into ‘master’… error: RPC failed; curl 56 SSLRead() return error -9806 fatal: The remote end hung up unexpectedly fatal: early EOF fatal: index-pack failed
錯誤情況二:
$ pod setup Setting up CocoaPods master repo [!] /usr/bin/git clone [https://github.com/CocoaPods/Specs.git](https://github.com/CocoaPods/Specs.git) master Cloning into ‘master’… error: RPC failed; curl 18 transfer closed with outstanding read data remaining fatal: The remote end hung up unexpectedly fatal: early EOF fatal: index-pack failed
我們知道pod setup這一步等待的時間非常漫長,有可能等了幾個小時最終卻失敗,不得不查詢解決辦法重來。
以上兩個錯誤的解決辦法
1. 檢查版本更新
$ sudo gem update --system
2.解除安裝老的cocoapods
$ sudo gem uninstall cocoapods
解除安裝完之後,終端會出現以下內容
Select gem to uninstall: 1. cocoapods-1.3.1 2. cocoapods-1.4.0.beta.2 3. cocoapods-1.5.0 4. All versions >
終端幫你列舉出了所有的cocoapods版本,你在末尾的“>”後面直接輸入對應的序號,就是解除安裝序號對應的版本,例如輸入1,就是解除安裝cocoapods-1.3.1,輸入4,就是解除安裝所有版本,這裡你直接輸入4即可。
3.重灌
$ sudo gem install -n /usr/local/bin cocoapods --pre
如果你的mac系統是10.11之前,則輸入“sudo gem install cocoapods”
4.終端輸入如下2條指令
$ sudo chmod +rx /usr/local/bin
$ sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
注意:上面的第2條指令中,-switch後面的路徑有些人可能不同,你直接從你的應用程式裡,將Xcode子檔案中的Developer直接拖到終端即可
5. pod setup
$ pod setup
成功之後,終端出現如下內容
7C88FA2D-5D90-43D3-B5AF-552C1CFFC43C.png