Setting up CocoaPods master repo 问题解决

系统更新,我在安装cocoapodsfa遇到了下面一些问题,几番折腾才成功安装。这里和大家分享一下:

问题:路径错误

➜  ~  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 -9806

fatal: The remote end hung up unexpectedly

fatal: early EOF

fatal: index-pack failed

我的系统是:macOS Sierra 10.12.1

开发工具:Xcode8

解决办法:

➜  ~  pod repo list

0 repos

这表示cocoapods并没有被成功安装,删除master分支 重新建立新的分支

➜  ~  sudo -rm -rf ~/.cocoapods/

usage: sudo -h | -K | -k | -Vusage: sudo -v [-AknS] [-g group] [-h host] [-p prompt] [-u user]usage: sudo -l [-AknS] [-g group] [-h host] [-p prompt] [-U user] [-u user] [command]usage: sudo [-AbEHknPS] [-C num] [-g group] [-h host] [-p prompt] [-u user] [VAR=value] [-i|-s] []usage: sudo -e [-AknS] [-C num] [-g group] [-h host] [-p prompt] [-u user] file ...

➜  ~  sudo xcode-select --switch /Applications/Xcode-beta.app

/Applications/Xcode-beta.app这个路径请不要复制粘贴,而是打开finder,应用程序,将Xcode拖到终端生成路径

获取Xcode路径

检验路径:

➜  ~  xcode-select --print-path

/Applications/Xcode-beta.app/Contents/Developer

再次更新

➜  ~  pod setup

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

测试一下CocoaPods是否能用

➜  ~  pod search afnetworking

-> AFNetworking+AutoRetry (0.0.5)

Auto Retries for AFNetworking requests

pod 'AFNetworking+AutoRetry', '~> 0.0.5'

- Homepage: https://github.com/shaioz/AFNetworking-AutoRetry

- Source:  https://github.com/shaioz/AFNetworking-AutoRetry.git

- Versions: 0.0.5, 0.0.4, 0.0.3, 0.0.2, 0.0.1 [master repo]

这样就OK了,安装完毕。

推荐阅读更多精彩内容