欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

CocoaPods安装遇到的问题

程序员文章站 2022-05-29 08:19:11
...

在天朝的国度里,能“*”去安装CocoaPods那是再适合不过的了,但是由于种种原因,本人选择了不“*”去安装CocoaPods,在简书中搜索“CocoaPods的安装使用和常见问题”文章淋漓满目,都是前人遇到或者已经解决的问题,本人只是记录在安装CocoaPods的过程遇到的一些问题,以防后期忘记。
在按照网上一些教程安装之后,遇到以下问题:

问题一:出现:[!] To setup the master specs repo, please run pod setup.

解决:git clone https://git.coding.net/CocoaPods/Specs.git ~/.cocoapods/repos/master
           pod setup  //务必在手动下载代码后执行一次,执行后 Setup completed

问题二:AgandeMacBook-Pro:~ Agan$ pod setup
Setting up CocoaPods master repo
[!] /usr/bin/git clone https://github.com/CocoaPods/Specs.git master
Cloning into 'master'...
error: RPC failed; curl 56 SSLRead() return error -36
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed

解决:sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer(参照网上方法,好像还是没用,依旧报上面错误)
**终端输入:pod repo list**
查看repo信息,结果:0 repos
再次输入:cd ~/.cocoapods/              -----(进入~/.cocoapods/)
接着:sudo -rm -rf ~/.cocoapods/    ------(将~/.cocoapods/删掉)
删掉后再次输入:pod setup
看到如下信息,但是还是报错:
[!] /usr/bin/git clone https://github.com/CocoaPods/Specs.git master
Cloning into 'master'...
error: RPC failed; curl 56 SSLRead() return error -36
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed
更新一下:sudo gem update --system  后再pod setup
那么,看到如下信息,恭喜你,安装成功了
AgandeMacBook-Pro:.cocoapods Agan$ pod setup    ---(此过程具体看你的源是在哪里,下载的过程超级慢长,我的源是:https://gems.ruby-china.org/,花了一晚上才下载好,一共好像894M吧)
Setting up CocoaPods master repo
CocoaPods 1.2.0.beta.1 is available.
To update use: `sudo gem install cocoapods --pre`
[!] This is a test version we'd love you to try.
For more information, see https://blog.cocoapods.org and the CHANGELOG for this version at https://github.com/CocoaPods/CocoaPods/releases/tag/1.2.0.beta.1
Setup completed

备注:若想查看下载的信息
另外打开一个终端:进入cd ~/.cocoapods
查看下载信息:du -sh *
信息如下:
AgandeMacBook-Pro:.cocoapods Agan$ du -sh *
894M repos
概括的总结一下:遇到问题一般也就是源、网络慢、没跟新gem、删掉~/.cocoapods/再安装、再更新gem,希望这篇文章能帮助那些遇到相同问题的人