在國內,使用brew極慢. 因為它需要訪問國外的一些服務器.
解決方法是使用國內的鏡像站.
如果是首次安裝:
curl https://raw.githubusercontent.com/Homebrew/install/master/install.sh > install-brew.sh
然后,在下載的文件中, 修改BREW_REPO為:
BREW_REPO="https://mirrors.ustc.edu.cn/brew.git"
最后, 運行:
HOMEBREW_CORE_GIT_REMOTE=https://mirrors.ustc.edu.cn/homebrew-core.git bash install-brew.sh
如果是已經安裝了brew, 可以這樣替換鏡像站:
cd "$(brew --repo)" git remote set-url origin https://mirrors.ustc.edu.cn/brew.git echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.bash_profile source ~/.bash_profile cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core" git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git
替換后, 就可以正常使用brew了.