解决CocoaPods慢的方案(gem和pod repo换源)
2016-12-08 本文已影响1538人
lancely
gem换源
$ gem sources --remove https://rubygems.org/ # 移除默认源
$ gem sources -a https://gems.ruby-china.org/ # 添加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
我们把它换成Coding.net
源
$ pod repo remove master
$ pod repo add master https://git.coding.net/CocoaPods/Specs.git
$ pod repo update
如果执行pod repo add
出现以下错误

那么使用以下办法
$ git clone https://git.coding.net/CocoaPods/Specs.git ~/.cocoapods/repos/master
$ pod repo update
另外,如果Podfile
文件中有
source 'https://github.com/CocoaPods/Specs.git'
也需要把它换成repo的源,否则依然是使用GitHub源
上面的步骤都完成后,即可使用
$ pod install
$ pod update