homebrew主要分兩部分:git repo(位于GitHub)和二進制bottles(位于bintray),這兩者在國内通路都不太順暢。可以替換成國内的鏡像,git repo國内鏡像比較多:
替換Homebrew預設源
# 替換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 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