Skip to content

Instantly share code, notes, and snippets.

@zcaudate
Forked from shrekuu/homebrew-mirror-in-china.sh
Created February 18, 2021 12:31
Show Gist options
  • Save zcaudate/d5c85a9a3541a4e99a10824eb28a19f5 to your computer and use it in GitHub Desktop.
Save zcaudate/d5c85a9a3541a4e99a10824eb28a19f5 to your computer and use it in GitHub Desktop.
homebrew 中国镜像服务, 清华大学与中科大
# 清华大学:
cd "$(brew --repo)"
git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.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
# 手动修改 bottles 地址:
export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles
# 或:
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles' >> ~/.bash_profile
source ~/.bash_profile
# 中国科大:
cd "$(brew --repo)"
git remote set-url origin https://mirrors.ustc.edu.cn/brew.git
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git
# 手动修改 bottles 地址:
export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles
brew update
# 恢复
cd "$(brew --repo)"
git remote set-url origin https://github.com/Homebrew/brew.git
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://github.com/Homebrew/homebrew-core.git
# 拖动移除 .zshrc 或 .bash_profile 里 HOMEBREW_BOTTLE_DOMAIN 的配置
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment