Cocoapods正確的安裝方式

每次時(shí)間就了都會(huì)忘記,記錄一下。

網(wǎng)上花里胡哨亂七八糟。按照這個(gè)只需要4步安裝完成。

1.安裝 Homebrew

/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"

最好選清華的源。中科大好像有點(diǎn)問(wèn)題。

其中會(huì)出現(xiàn)錯(cuò)誤,按照提示執(zhí)行 run后面的命令:

2.執(zhí)行brew install ruby

這里如果出現(xiàn):Error: Command failed with exit 128: git

執(zhí)行:unset HOMEBREW_BOTTLE_DOMAIN

然后重新:brew install ruby就好了

可能出現(xiàn)錯(cuò)誤:fatal: not in a git directory

Error: Command failed with exit 128: git

解決方案:順序執(zhí)行

git config --global --add safe.directory /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core

git config --global --add safe.directory /usr/local/Homebrew/Library/Taps/homebrew/homebrew-services

git config --global --add safe.directory /usr/local/Homebrew/Library/Taps/homebrew/homebrew-caskgit

重新執(zhí)行:brew install ruby

3.sudo gem update --system

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

如果在12遇到權(quán)限問(wèn)題:

升級(jí) cocoapods 報(bào)錯(cuò)

報(bào)錯(cuò) You don't have write permissions for the /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/

用命令

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

安裝或升級(jí)cocoapods 報(bào)錯(cuò),You don't have write permissions for the /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/

解決辦法:

用命令

brew install cocoapods

進(jìn)行升級(jí)或安裝

就此安裝完畢,拒絕花里胡哨的亂七八糟的操作。

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

友情鏈接更多精彩內(nèi)容