Mac brew命令踩坑


brew是mac上的在線包管理軟件,相當於linux apt以及yum包管理工具

1.取消brew的自動更新(https://blog.csdn.net/yf9595/article/details/79843317)
mac上使用brew install /brew cask install安裝軟件總是先updating HomeBrew…
速度很慢,可以在用戶主目錄下的shell配置文件.bash_profile中添加:

export HOMEBREW_NO_AUTO_UPDATE=true

再執行source ~/.bash_profile, 即可取消自動更新brew,

2.下載慢更新brew三個源
https://learnku.com/articles/18908
https://blog.csdn.net/hardhard123/article/details/84193021
https://lug.ustc.edu.cn/wiki/mirrors/help/brew.git(中科大官網配置)

3.brew install 如果沒有取消自動更新,每次都要更新好久,如果這時候意外按下control+z,再次執行brew install會提示Error: Another active Homebrew update process is already in progress.Please wait for it to finish or terminate it to continue.

解決辦法:rm -rf /usr/local/var/homebrew/locks

4.brew 如果不是在root用戶下安裝的,brew install會提示權限不足,類似這樣的提示

Error: An unexpected error occurred during the `brew link` step
The formula built, but is not symlinked into /usr/local
Permission denied @ dir_s_mkdir - /usr/local/Frameworks
Error: Permission denied @ dir_s_mkdir - /usr/local/Frameworks
promote:~ admin$ sudo brew install --HEAD libimobiledevice
Password:
Error: Running Homebrew as root is extremely dangerous and no longer supported.
As Homebrew does not drop privileges on installation you would be giving all
build scripts full access to your system.

解決辦法:

sudo chown -R $(whoami):admin /usr/local  
sudo chown -R $(whoami) Homebrew安裝路徑
brew doctor 檢測下是否解決,再次執行brew install即可正常安裝

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM