homebrew加速

这里替换为中科大的源进行加速

替换 brew.git

1
2
cd `brew --repo`
git remote set-url origin https://mirrors.ustc.edu.cn/brew.git

替换 homebrew-core.git

1
2
cd "`brew --repo`/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git

详细信息,前往中科大替换及重置 Homebrew 默认源

替换 homebrew-bottles

  • Bash 终端配置
1
2
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.bash_profile
source ~/.bash_profile
  • Zsh 终端配置
1
2
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.zshrc
source ~/.zshrc

详见中科大替换 Homebrew Bottles 源

在中科大失效或者宕机时可以

1
2
3
4
5
6
7
# 重置brew.git
cd "$(brew --repo)"
git remote set-url origin https://github.com/Homebrew/brew.git

# 重置homebrew-core.git
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://github.com/Homebrew/homebrew-core.git

将终端配置文件文件 ~/.bash_profile 或者 ~/.zshrc 中的 HOMEBREW_BOTTLE_DOMAIN 删除

执行 source 命令使之生效

1
source ~/.bash_profile

或者

1
source ~/.zshrc