iOS-第一次安装cocoapods很慢或出错怎么办?
appledeiMac: jz$ pod install
Analyzing dependencies
Cloning spec repo `cocoapods` from `https://github.com/CocoaPods/Specs.git`
[!] Unable to add a source with url `https://github.com/CocoaPods/Specs.git` named `cocoapods`.
You can try adding it manually in `/Users/jz/.cocoapods/repos` or via `pod repo add`.
无论是用命令行sudo gem install cocoapods
安装的,还是直接安装的cocoapods的客户端,在第一次使用cocoapods的时候,因为他需要先把所有iOS库的索引都下载下来,所以难免会出现下载慢或出错的情况。
最经典的错误:
#### error: RPC failed; result=18, HTTP code = 200
#### fatal: The remote end hung up unexpectedly
#### fatal: early EOF
#### fatal: index-pack failed
#### [!] Unable to add a source with url [github.com/CocoaPods/S…](https://github.com/CocoaPods/Specs.git) named master. You can try adding it manually in ~/.cocoapods/repos or via pod repo add
解决方案:
1.进 https://github.com/CocoaPods/Specs 选择download zip
2.打开终端,输入rm -rf ~/.cocoapods
按回车
3.输入mkdir -p ~/.cocoapods/repos/master
按回车
4.输入open ~/.cocoapods/repos/master
,按回车。打开finder
5.把第一步中下载的zip包解压,并把其中划红线的这几个文件(夹)复制进上一步打开的master文件夹中:
6.回到终端,输入cd ~/.cocoapods/repos/master
,按回车
7.输入git init
,按回车
8.输入git remote add origin https://github.com/CocoaPods/Specs
,按回车