brew install XXX一直卡在UpdateHomebrew…

1、解决方案

1、清理缓存

brew cleanup

2、 切换国内源

vim /Users/zhanghongyu21/.zprofile
#切换阿里源
cd "$(brew --repo)" 
git remote set-url origin https://mirrors.ustc.edu.cn/brew.git

#切换原来的源
#替换homebrew-core.git:
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git 

3、关闭自动更新

vim /Users/xxx/.zprofile #mac目录

#1.编辑 ~/.bash_profile  #linux目录
sudo vim ~/.bash_profile

#2.在 ~/.bash_profile文件中添加关闭brew自动更新
export HOMEBREW_NO_AUTO_UPDATE=true

#3.让添加的内容生效
source ~/.bash_profile

4、卸载重新安装

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)"
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

你可能感兴趣的:(mac,brew)