1.替换brew
$ cd "$(brew --repo)"

$ git remote set-url origin https://mirrors.ustc.edu.cn/brew.git
2.替换 homebrew-core.git
$ cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"

$ git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git
3.替换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
4.替换homebrew-cask
cd "$(brew --repo)"/Library/Taps/homebrew/homebrew-cask
git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-cask.git

参考:http://mirrors.ustc.edu.cn/help/homebrew-cask.git.html#