Skip to content

Instantly share code, notes, and snippets.

@blanklin030
Created August 3, 2018 10:17
Show Gist options
  • Save blanklin030/58e009683ea8e10036fd57bb21ad20d0 to your computer and use it in GitHub Desktop.
Save blanklin030/58e009683ea8e10036fd57bb21ad20d0 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

更新源

cd
drew update

清华源异常,切回homebrew源

  • 重置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

  • 更新
cd
brew update
  • 注释掉bash配置文件里的有关Homebrew Bottles
vim ~/.bash_profile
#export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles
  • 重启bash或让bash重读配置文件。
source ~/.bash_profile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment