homebrew

替换homebrew源

Homebrew 主要有四个部分组成: brewhomebrew-corehomebrew-bottleshomebrew-cask

名称 说明
brew Homebrew 源代码仓库
homebrew-core Homebrew 核心软件仓库
homebrew-bottles Homebrew 预编译二进制软件包
homebrew-cask 提供 macOS 应用和大型二进制文件

阿里源

  1. # 查看 brew.git 当前源
  2. $ cd "$(brew --repo)" && git remote -v
  3. origin https://github.com/Homebrew/brew.git (fetch)
  4. origin https://github.com/Homebrew/brew.git (push)
  5. # 查看 homebrew-core.git 当前源
  6. $ cd "$(brew --repo homebrew/core)" && git remote -v
  7. origin https://github.com/Homebrew/homebrew-core.git (fetch)
  8. origin https://github.com/Homebrew/homebrew-core.git (push)
  9. # 修改 brew.git 为阿里源
  10. $ git -C "$(brew --repo)" remote set-url origin https://mirrors.aliyun.com/homebrew/brew.git
  11. # 修改 homebrew-core.git 为阿里源
  12. $ git -C "$(brew --repo homebrew/core)" remote set-url origin https://mirrors.aliyun.com/homebrew/homebrew-core.git
  13. # zsh 替换 brew bintray 镜像
  14. $ echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.aliyun.com/homebrew/homebrew-bottles' >> ~/.zshrc
  15. $ source ~/.zshrc
  16. # bash 替换 brew bintray 镜像
  17. $ echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.aliyun.com/homebrew/homebrew-bottles' >> ~/.bash_profile
  18. $ source ~/.bash_profile
  19. # 刷新源
  20. $ brew update

清华源

  1. # 替换各个源
  2. $ git -C "$(brew --repo)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git
  3. $ git -C "$(brew --repo homebrew/core)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git
  4. $ git -C "$(brew --repo homebrew/cask)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask.git
  5. # zsh 替换 brew bintray 镜像
  6. $ echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles' >> ~/.zshrc
  7. $ source ~/.zshrc
  8. # bash 替换 brew bintray 镜像
  9. $ echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles' >> ~/.bash_profile
  10. $ source ~/.bash_profile
  11. # 刷新源
  12. $ brew update

中科大

  1. # 替换各个源
  2. $ git -C "$(brew --repo)" remote set-url origin https://mirrors.ustc.edu.cn/brew.git
  3. $ git -C "$(brew --repo homebrew/core)" remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git
  4. $ git -C "$(brew --repo homebrew/cask)" remote set-url origin https://mirrors.ustc.edu.cn/homebrew-cask.git
  5. # zsh 替换 brew bintray 镜像
  6. $ echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.zshrc
  7. $ source ~/.zshrc
  8. # bash 替换 brew bintray 镜像
  9. $ echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.bash_profile
  10. $ source ~/.bash_profile
  11. # 刷新源
  12. $ brew update

重置为官方源

  1. # 重置 brew.git 为官方源
  2. $ git -C "$(brew --repo)" remote set-url origin https://github.com/Homebrew/brew.git
  3. # 重置 homebrew-core.git 为官方源
  4. $ git -C "$(brew --repo homebrew/core)" remote set-url origin https://github.com/Homebrew/homebrew-core.git
  5. # 重置 homebrew-cask.git 为官方源
  6. $ git -C "$(brew --repo homebrew/cask)" remote set-url origin https://github.com/Homebrew/homebrew-cask
  7. # zsh 注释掉 HOMEBREW_BOTTLE_DOMAIN 配置
  8. $ vi ~/.zshrc
  9. # export HOMEBREW_BOTTLE_DOMAIN=xxxxxxxxx
  10. # bash 注释掉 HOMEBREW_BOTTLE_DOMAIN 配置
  11. $ vi ~/.bash_profile
  12. # export HOMEBREW_BOTTLE_DOMAIN=xxxxxxxxx
  13. # 刷新源
  14. $ brew update

iTerm2 配置