HomeBrew切换国内源
1. 修改源镜像
1.1 替换为清华大学镜像站
git -C "$(brew --repo)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git
git -C "$(brew --repo homebrew/core)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git
git -C "$(brew --repo homebrew/cask)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask.git
brew update
1.2 还原github(国内有时会出一些无法理解的bug)
git -C "$(brew --repo)" remote set-url origin https://github.com/Homebrew/brew.git
git -C "$(brew --repo homebrew/core)" remote set-url origin https://github.com/Homebrew/homebrew-core.git
git -C "$(brew --repo homebrew/cask)" remote set-url origin https://github.com/Homebrew/homebrew-cask.git
brew update
2.修改bottles
在shell配置文件(例如:.zshrc)加入以下环境变量
export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles
使配置文件生效
source ~/.zshrc
3.常见问题
碰到问题时,执行以下命令,然后按照命令提示修改
brew doctor
男儿走四方,何处不为家
死在哪里,葬在哪里,天下青山一样