mac默认的homebrew源托管到github,在国内访问的话,奇慢无比,所以在执行brew install ***的时候,要执行N久,解决这个问题的方式就是替换brew源,目前我们采用中科大的源,来替代github
1. 替换brew github地址
cd "$(brew --repo)"
git remote set-url origin https://mirrors.ustc.edu.cn/brew.git
2. 替换brew-core github地址
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git
3. 替换brew-cask github地址
cd /usr/local/Homebrew/Library/Taps/caskroom/homebrew-cask
git remote set-url origin git://mirrors.ustc.edu.cn/homebrew-cask.git
4. 替换homebrew bottles,修改环境变量
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.bash_profile
source ~/.bash_profile