解决CocoaPods慢的方案(gem和pod repo换源)

gem换源

$ gem sources --remove https://rubygems.org/ # 移除默认源
$ gem sources -a https://gems.ruby-china.com/ # 添加Ruby China镜像
$ gem sources -l

确保只有gems.ruby-china.org

pod repo换源

$ pod repo

默认是GitHub

master
- Type: git (master)
- URL: https://github.com/CocoaPods/Specs.git
- Path: /Users/cheng/.cocoapods/repos/master

1 repo

我们把它换成清华tuna

对于旧版的 CocoaPods 可以使用如下方法使用 tuna 的镜像

$ pod repo remove master
$ pod repo add master https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git
$ pod repo update

新版的 CocoaPods 不允许用pod repo add直接添加master库了。如果执行pod repo add出现以下错误

 

错误

那么使用以下办法

$ pod repo remove master
$ git clone https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git ~/.cocoapods/repos/master

另外,如果Podfile文件中有

source 'https://github.com/CocoaPods/Specs.git'

也需要把它换成repo的源,否则依然是使用GitHub源
上面的步骤都完成后,即可使用

$ pod install
$ pod update

出现的问题

CDN: trunk URL couldn't be downloaded: https://raw.githubusercontent.com/CocoaPods/Specs/master/S...

 

方法一:可使用脱离trunk方式,打开podfile文件,按照指定旧方式下载

>//source `源地址`

source 'https://github.com/CocoaPods/Specs.git'

方法二:可移除trunk

pod repo remove trunk

 

  • 3
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值