写在前面
HomeBrew的阿里源太慢了,中科大源快了不少

  1. 查看并替换源
  • 查看当前源:
# 查看brew.git当前源
cd "$(brew --repo)" && git remote -v 
# 查看homebrew-core.git当前源
cd "$(brew --repo homebrew/core)" && git remote -v
  • 换为中科大源:
# 替换brew.git:
cd "$(brew --repo)" && git remote set-url origin https://mirrors.ustc.edu.cn/brew.git
# 替换homebrew-core.git:
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core" && git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git
# 替换homebrew-cask.git:
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-cask" && git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-cask.git
  • 编辑 .zshrc
#在.zshrc文件后加入
export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles
export HOMEBREW_BREW_GIT_REMOTE=https://mirrors.ustc.edu.cn/brew.git
export HOMEBREW_CORE_GIT_REMOTE=https://mirrors.ustc.edu.cn/homebrew-core.git

参考文章: