淘宝的那个镜像(https://ruby.taobao.org/ )已经不可用了。所以我们现在用最新支持的ruby镜像(https://gems.ruby-china.org/)
需要的命令行:
$ gem sources -r https://rubygems.org/ (移除旧版本的镜像,如果你不知道你电脑上目前用的是什么镜像,可用 $ gem sources -l 来查看)
$ gem sources -a https://gems.ruby-china.org/ (增加可用的镜像)
$ gem sources -l (用来检查使用替换镜像位置成功)
$sudo gem install cocoapods (可能会报错)
ERROR: SSL verification error at depth 2: unable to get local issuer certificate (20)
ERROR: You must add /C=US/O=VeriSign, Inc./OU=Class 3 Public Primary Certification Authority to your local trusted store
ERROR: SSL verification error at depth 1: unable to get local issuer certificate (20)
ERROR: You must add /C=IL/O=StartCom Ltd./OU=Secure Digital Certificate Signing/CN=StartCom Certification Authority to your local trusted store
ERROR: SSL verification error at depth 2: self signed certificate in certificate chain (19)
ERROR: Root certificate is not trusted (/C=US/O=GeoTrust Inc./CN=GeoTrust Global CA)
ERROR: While executing gem ... (Errno::EPERM)
Operation not permitted - /usr/bin/pod
####执行以下命令
$ sudo gem install -n /usr/local/bin cocoapods
$ pod setup
$ pod --version