leelongcrazy's blog

brew源管理

brew源管理

Mac系统下brew工具源管理

  1. 显示brew安装位置
brew --repo
  1. 查看brew目前所使用的源
git -C "$(brew --repo)" remote get-url origin
git -C "$(brew --repo) homebrew/core" remote get-url origin
git -C "$(brew --repo) homebrew/cask)" remote get-url origin
  1. 更换为清华源
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 # 执行更新
  1. 恢复默认源
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 # 执行更新

IT Tech, os