1. 问题
每次运行brew下载(install)或更新(update)软件时,homebrew都会先自动更新,过程很慢,卡很久。
2. 解决方案
所以,我们可以更新brew源和关闭brew执行命令时的自动更新。
- 替换brew源
中科大源
// 替换brew源
# 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 update
清华源
// 替换brew源
# cd "$(brew --repo)"
# git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/brew.git
// 替换homebrew-core.git
# cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
# git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew-core.git
# brew update
- 关闭brew自动更新
// 编辑配置文件
# vim ~/.bash_profile
// 文件内新增一行
# export HOMEBREW_NO_AUTO_UPDATE=true
// 重新加载配置文件
# source ~/.bash_profile