- 檢測gem版本分唾。
$ gem -v
(注:現(xiàn)在gem版本一般都高于2.6.x狮斗。再低的情況也比較少了)
2.將ruby源切換回國內(nèi)的。
$ gem sources --add https://gems.ruby-china.com/
--remove https://rubygems.org/
3.確保只有"https://gems.ruby-china.com/"一個(gè)ruby源折砸。
$ gem sources -l
4.更新cocoapods看疗。
這里說明一下,下面的這個(gè)方法可能會有多個(gè)error(我當(dāng)初是碰到了)去枷。
$ gem install cocoapods -n /usr/local/bin
報(bào)錯(cuò)如下:
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /Library/Ruby/Gems/2.3.0 directory.
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /usr/bin directory.
最終借鑒了前輩們的經(jīng)驗(yàn),用的是下面的這個(gè)命令:
$ sudo gem install -n /usr/local/bin cocoapods --pre
感謝
@月球上的人已被使用啦
@chrisbin
參考鏈接:https://www.cnblogs.com/chrisbin/p/5413777.html
參考鏈接:http://www.reibang.com/p/3ad1cdca9d7f