原因
brew update
實(shí)際上會從https://github.com/homebrew/brew更新代碼。具體可以用brew update -v
查看進(jìn)度就知道了。
既然資源訪問太慢原因造成的,那就替換一下鏡像就可以了
替換鏡像
# brew 程序本身沪饺,Homebrew/Linuxbrew 相同
git -C "$(brew --repo)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git
# 以下針對 mac OS 系統(tǒng)上的 Homebrew
# brew
cd "$(brew --repo)" && git remote set-url origin https://mirrors.ustc.edu.cn/brew.git
# homebrew-core
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core" && git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git
# homebrew-cask
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-cask" && git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-cask.git
# Homebrew Bottles (Homebrew 預(yù)編譯二進(jìn)制軟件包)
```shell
對于 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
更換后測試工作是否正常
brew update
參考:
1、[http://www.reibang.com/p/62f1b963baa6](http://www.reibang.com/p/62f1b963baa6)
2、[https://mirrors.tuna.tsinghua.edu.cn/help/homebrew/](https://mirrors.tuna.tsinghua.edu.cn/help/homebrew/)
3团搞、[Homebrew Bottles 源使用幫助](http://mirrors.ustc.edu.cn/help/homebrew-bottles.html)