查找当前Ruby默认源
gem sources -l
会自动输出显示:
因为实在中国使用,无法直接翻墙到国外
需要更改这个默认Ruby
输入以下,删除默认Ruby:
gem sources --remove https://rubygems.org/
使用新的源,输入
gem sources -a https://ruby.taobao.org/
验证新源是否替换成功,输入
gem sources -l
显示已经更换成国内的了
接下来是开始安装CocoaPods:
(1) (这句是以前的用法,新版本系统可能会报错,不建议使用这句)sudo gem install cocoapods
备注:苹果系统升级 OS X EL Capitan 后改为
sudo gem install -n /usr/local/bin cocoapods
(2) 然后
pod setup
然后会自动进入下载等待,这句执行多久就看你网速了,我下了300多MB:
DerekdeMacBook-Pro:~ derek$ pod setup
Setting up CocoaPods master repo
$ /usr/bin/git clone https://github.com/CocoaPods/Specs.git master --progress
Cloning into 'master'...
remote: Counting objects: 1242823, done.
remote: Compressing objects: 100% (618/618), done.
remote: Total 1242823 (delta 306), reused 35 (delta 35), pack-reused 1242142
Receiving objects: 100% (1242823/1242823), 395.42 MiB | 575.00 KiB/s, done.
Resolving deltas: 100% (606525/606525), done.
Checking out files: 100% (153320/153320), done.
Setup completed
Setup completed说明安装成功了。