Homebrew 国内使用加速

本文首发于 我的博客站点 大江小浪 - Homebrew 国内使用加速 ,欢迎大家访问原文查看。

可以选择的源:

  • 清华大学 mirrors.tuna.tsinghua.edu.cn
  • 中科大 mirrors.ustc.edu.cn

替换 Homebrew 默认源

# 替换 brew.git
cd "$(brew --repo)"
git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git

# 替换 homebrew-core.git
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git

brew update

替换 Home-brew Bottles 源

#对于bash用户
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles' >> ~/.bash_profile
source ~/.bash_profile

#对于zsh用户
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles' >> ~/.zshrc
source ~/.zshrc

测试下速度,果然飞起了

$ brew install wget

恢复默认设置的办法

# 重置brew.git:
cd "$(brew --repo)"
git remote set-url origin https://github.com/Homebrew/brew.git

# 重置homebrew-core.git:
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://github.com/Homebrew/homebrew-core.git

brew update
posted @ 2022-03-17 22:01  Cocowool  阅读(1826)  评论(0编辑  收藏  举报