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即可正常安装

猜你喜欢

转载自www.cnblogs.com/feibazhf/p/11146343.html
今日推荐