brew 替换国内镜像
问题
在使用brew install
的时候, 经常会卡在Updating Homebrew...
这是因为国内访问国外地址很慢的原因, 虽然可以使用ctrl+c
来跳过, 但总想着能不能替换国内源呢?
解决
运行以下命令替换brew
的 git 源:
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
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles' >> ~/.bash_profile
source ~/.bash_profile
# 更新源之后, 重置本地 git HEAD
brew update-reset
OK, 现在已经替换完成了, 快体验一下这久违速度吧
使用清华源, 地址: