MacBook pro 修改Homebrew 为中国源
问题:
每次使用Homebrew安装都会卡在Updating Homebrew…
他会访问GitHub,会很慢。
解决方法:
在~/.bash_profile中添加下列设置,设置中科大源
vi ~/.bash_profile
# Homebrew source config
export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles
export HOMEBREW_API_DOMAIN=https://mirrors.ustc.edu.cn/homebrew/api
source ~/.bash_profile
然后再执行(可能要连接 微PN):
brew update
注意:这时候git可能会断,出现early EOF问题。 在执行上面代码前设置git 缓存。
git config --global http.postBuffer 1048576000
git config --global core.compression 0
git config --global http.lowSpeedLimit 0
git config --global http.lowSpeedTime 999999
git config --global http.maxRequests 50
git config --global http.maxRetries 5
git config --global http.retryDelay 5
然后执行brew update。
最后更改成功,执行很快。
参考:
https://mirrors.ustc.edu.cn/help/brew.git.html