对于 homebrew,需要替换的是4个模块的镜像:
- Homebrew
- Homebrew Core
- Homebrew-bottles
- Homebrew Cask
# 替换 Homebrew
git -C "$(brew --repo)" remote set-url origin https://mirrors.ustc.edu.cn/brew.git
# 替换 Homebrew Core
git -C "$(brew --repo homebrew/core)" remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git
# 替换 Homebrew Cask
git -C "$(brew --repo homebrew/cask)" remote set-url origin https://mirrors.ustc.edu.cn/homebrew-cask.git
# 替换 Homebrew-bottles
# 对于 bash 用户:
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.bash_profile
source ~/.bash_profile
# 对于 zsh 用户:
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.zshrc
source ~/.zshrc
ps:亲测可用
参考:
- Homebrew有比较快的源(mirror)吗? - 王不知的回答 - 知乎 https://www.zhihu.com/question/31360766/answer/749386652
- 打造 Mac “完美”终端(Terminal),一篇就够了 https://makeoptim.com/tool/terminal