Updating Homebrew…解决方案:
方案一:关闭Homebrew 自动更新
当我们在Mac下使用brew安装软件时,经常会遇到brew install XXX 自动会跳到Updating Homebrew…。即使网速非常好的情况下,也会卡很久才会开始install。网速不好的情况下,半天过去了还不一定安装完。
主要原因是由于Mac电脑brew自动更新默认开启,最终解决方案是,关闭brew的自动哦更新。
执行命令: (注意很多博客上都没有第三步,让配置之后重启电脑才能生效;第三步执行之后,配置的内容就直接生效,不需要重启电脑)
#1.编辑 ~/.bash_profile
sudo vim ~/.bash_profile
#2.在 ~/.bash_profile文件中添加关闭brew自动更新
export HOMEBREW_NO_AUTO_UPDATE=true
#3.让添加的内容生效
source ~/.bash_profile
方案二:替换Homebrew更新地址
解决办法是替换brew源:
#替换brew.git:
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
#重置brew.git:
cd "$(brew --repo)"
git remote set-url origin https://github.com/Homebrew/brew.git
#重置homebrew-core.git:
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://github.com/Homebrew/homebrew-core.git
建议采用第一种方案,避免每次都需要Updating Homebrew。如有需要可以过一段时间可以在更新一次Homebrew。