一、查看是否有已安装的镜像源
命令:gem sources -l
输出:
*** CURRENT SOURCES ***
https://gems.ruby-china.org/
二、将不可用的源 https://gems.ruby-china.org/ 换成 https://gems.ruby-china.com/
1)移除 https://gems.ruby-china.org/
命令:gem sources --remove https://gems.ruby-china.org/
2)换成 https://gems.ruby-china.com/
命令:gem sources -a https://gems.ruby-china.com/
输出:https://gems.ruby-china.com/ added to sources
三、安装cocoapods
安装之前先更新一下:
命令:sudo gem update--system
命令:sudo gem install -n /usr/local/bin cocoapods
以上已完成安装。
------------------------------------------------------------------------------------
若要修改源提速(以清华的镜像为例):
cd ~/.cocoapods/repos
pod repo remove master
git clone https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git master
最后在podfile文件第一行添加:
source ‘https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git’