- 前言
Mac 升級(jí)了,CocoaPods又出問題了。每次都比較費(fèi)時(shí)間
總結(jié)一份文章總結(jié)下,各種問題的解決方案,以及原因。
- Cocoapods
已經(jīng)翻過墻的小伙伴請(qǐng)?zhí)^這步直接往下看:
gem sources -l // 查看當(dāng)前使用的鏡像站
gem sources --remove https://rubygems.org // 刪除 -l 出現(xiàn)的所有鏡像源地址
gem sources --add http://gems.ruby-china.org/ // 增加國(guó)內(nèi)ruby-china源
- 升級(jí) gem
使用 gem 命令升級(jí) rubygems
gem update --system
報(bào)錯(cuò)如下:
Fetching: rubygems-update-2.6.8.gem (100%)
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /Library/Ruby/Gems/2.0.0 directory.
執(zhí)行命令:
sudo gem update --system
在10.11之后,系統(tǒng)上已經(jīng)使用了Rootlees,可以理解為一個(gè)更高級(jí)的系統(tǒng)的內(nèi)核保護(hù)措施,系統(tǒng)默認(rèn)將會(huì)鎖定/system /sbin /usr這三個(gè)目錄。但是,這個(gè)保護(hù)是可以關(guān)閉的
解決辦法是執(zhí)行命令:
sudo gem update -n /usr/local/bin --system
安裝 CocoaPods,執(zhí)行命令:
sudo gem install -n /usr/local/bin cocoapods
最近更新私有第三方庫(kù),一直出現(xiàn) The repo `` at ../../../.cocoapods/repos/ is not clean ,于是谷歌呀,stackoverflow呀,終于在一個(gè)小時(shí)后解決了,問題就是私有庫(kù),修改了而沒有提交到倉(cāng)庫(kù)。cd 到私有倉(cāng)庫(kù),執(zhí)行命令:
git add .
git commit -m'111'
就可以解決
- 最后
參考文獻(xiàn): http://tadaland.com/os-x-rootless.html