Mac OS(10.11.4)安装CocoaPods
近来将Mac OS升级到10.11.4版本,在终端执行pod install,直接报command not found,真是奇怪。上网查了资料,才知道CocoaPods也要做相应的升级。马上直接在终端执行:
$ sudo gem install cocoapods
直接报错:
ERROR: While executing gem ... (Errno::EPERM)
Operation not permitted - /usr/bin/pod
解决方法:终端执行以下命令
$ sudo gem install -n /usr/local/bin cocoapods
执行成功执行下面信息:
Successfully installed cocoapods-1.0.0
Parsing documentation for cocoapods-1.0.0
Done installing documentation for cocoapods after 2 seconds
1 gem installed
现在已经更新安装成功,接下来在项目根目录下添加Podfile文件,终端执行
pod install (回车)
之后就一直停留在这里
Setting up CocoaPods master repo
开始以为是Ruby镜像源的问题,直接查看:
$ gem sources -l
的确是淘宝的,
*** CURRENT SOURCES ***
https://ruby.taobao.org/
我靠,这咋回事。查资料,后来发现需要将
https://github.com/CocoaPods/Specs.git master下库clone到本地目录:~/.cocoapods/repos才解决了问题
终端执行命令:
cd ~/.cocoapods/repos git clone https://github.com/CocoaPods/Specs.git master
clone 这一步比较耗时,请耐心等待clone好后,再执行pod install,完美解决问题。
参考:
http://gonghonglou.com/2016/04/01/UpdatePodsQue/
https://github.com/CocoaPods/CocoaPods/issues/4293