一、Mac brew 安装项目一直卡主,主要因为镜像问题太慢,更换中科大镜像,速度提升,操作如下:

cd "$(brew --repo)"
git remote set-url origin https://mirrors.ustc.edu.cn/brew.git

cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git


cd "$(brew --repo)"/Library/Taps/homebrew/homebrew-cask
git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-cask.git

echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.bash_profile

ln -s /usr/local/Homebrew/bin/brew /usr/local/bin/

 source ~/.bash_profile
brew update -v

二、更新过程中依然有时候报错,说明在更新中部分组件从github.com 下载网络不通导致.

199.232.28.133 raw.githubusercontent.com
140.82.114.3 github.com
140.82.114.3 nodeload.github.com
140.82.114.3 raw.github.com
140.82.114.3 documentcloud.github.com

github.com 的实时地址,从 https://ipchaxun.com/github.com/ 查询,找一个稍微稳定IP进行绑定即可,错误度过后,再把github.com 绑定取消,因为从获取其他包的时候,单机等待下载太慢.