我們在安裝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
卸載完之后,終端會出現(xiàn)以下內(nèi)容
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版本唠粥,你在末尾的“>”后面直接輸入對應(yīng)的序號,就是卸載序號對應(yīng)的版本停做,例如輸入1晤愧,就是卸載cocoapods-1.3.1,輸入4蛉腌,就是卸載所有版本官份,這里你直接輸入4即可。
3.重裝
$ sudo gem install -n /usr/local/bin cocoapods --pre
如果你的mac系統(tǒng)是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后面的路徑有些人可能不同,你直接從你的應(yīng)用程序里河咽,將Xcode子文件中的Developer直接拖到終端即可
5. pod setup
$ pod setup
成功之后钠右,終端出現(xiàn)如下內(nèi)容