2021 CocoaPods 第一次“pod install” 慢

本文介绍了解决CocoaPods首次安装缓慢或失败的方法,通过手动下载并配置Specs仓库来确保本地索引正常工作。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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,按回车

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值