Homebrew 国内使用加速
更新于:2023-05-04 22:38:34
发布于:2022-03-13 21:23:26
可以选择的源:
- 清华大学 mirrors.tuna.tsinghua.edu.cn
- 中科大 mirrors.ustc.edu.cn
替换 Homebrew 默认源
1 2 3 4 5 6 7 8 9
| cd "$(brew --repo)" git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core" git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git
brew update
|
替换 Home-brew Bottles 源
1 2 3 4 5 6 7
| echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles' >> ~/.bash_profile source ~/.bash_profile
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles' >> ~/.zshrc source ~/.zshrc
|
测试下速度,果然飞起了
恢复默认设置的办法
1 2 3 4 5 6 7 8 9
| cd "$(brew --repo)" git remote set-url origin https://github.com/Homebrew/brew.git
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core" git remote set-url origin https://github.com/Homebrew/homebrew-core.git
brew update
|
2023-05-04 更新,最近在安装的时候经常遇到清华源有 404 的错误,更换为中科大源之后速度恢复正常
参考资料
- mac上安装brew如何加速
- Homebrew国内加速
- 镜像助手