參考:https://juejin.im/post/5daec26a51882575d50cd0aa
1.查看brew當前源
git -C "$(brew --repo)" remote -v origin https://github.com/Homebrew/brew (fetch) origin https://github.com/Homebrew/brew (push)
2.改成清華的源
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
已經修改成清華的源
git -C "$(brew --repo)" remote -v origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git (fetch) origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git (push)
或者改成中科大的源
# 替換 Homebrew git -C "$(brew --repo)" remote set-url origin https://mirrors.ustc.edu.cn/brew.git # 替換 Homebrew Core git -C "$(brew --repo homebrew/core)" remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git # 替換 Homebrew Cask git -C "$(brew --repo homebrew/cask)" remote set-url origin https://mirrors.ustc.edu.cn/homebrew-cask.git # 更新 brew update
如果想還原
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