更新gem和pod

一、更新gem

1.查看gem版本號

gem -v

2.查看ruby源。

gem sources -l

3.替換ruby源(如果是https://gems.ruby-china.com, 則跳過3、4步)

gem sources --remove https://gems.ruby-china.org

gem sources --add https://gems.ruby-china.com

注意是https://gems.ruby-china.com 不是https://gems.ruby-china.org.

4.確保ruby源是https://gems.ruby-china.com

gem sources -l

5.更新gem版本

gem update --system

如果錯誤:

>ERROR: While executing gem ... (Gem::FilePermissionError)

You don't have write permissions for the /Library/Ruby/Gems/2.3.0 directory.

使用:

sudo gem update --system

6.打印gem版本號 是否成功

gem -v

二、更新CocoaPods

1.更新CocoaPods

sudo gem install cocoapods

如果錯誤:

ERROR: While executing gem ... (Gem::FilePermissionError)

You don't have write permissions for the /usr/bin directory.

使用:

sudo gem install -n /usr/local/bin cocoapods

卸載cocoapods :

 sudo gem uninstall cocoapods

2.git clone 要比git fetch快許多, 所以在使用cocoapods時儘量避免執行git fetch 參考: http://www.cocoachina.com/ios/20170208/18645.html

pod update --no-repo-update --verbose

--verbose的作用就是打印出執行過程中詳細的信息.

--no-repo-update的作用就是禁止更新repo, 這樣就避免執行了git fetch,從而加快速度。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章