安装Homebrew

  1. /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Homebrew源使用帮助

1.替换为USTC镜像:

  1. cd "$(brew --repo)"
  2. git remote set-url origin https://mirrors.ustc.edu.cn/brew.git

2.重置为官方镜像:

  1. cd "$(brew --repo)"
  2. git remote set-url origin https://github.com/Homebrew/brew.git

Homebrew Core 源使用帮助

1.替换为USTC镜像:

  1. cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
  2. git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git

2.重置为官方镜像:

  1. cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
  2. git remote set-url origin https://github.com/Homebrew/homebrew-core

Homebrew Cask 源使用帮助

1.替换为USTC镜像:

  1. cd "$(brew --repo)"/Library/Taps/homebrew/homebrew-cask
  2. git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-cask.git

2.重置为官方镜像:

  1. cd "$(brew --repo)"/Library/Taps/homebrew/homebrew-cask
  2. git remote set-url origin https://github.com/Homebrew/homebrew-cask

Caskroom 的 Git 地址在 2018 年 5 月 25 日从 https://github.com/caskroom/homebrew-cask 迁移到了 https://github.com/Homebrew/homebrew-cask

Homebrew Bottles 源使用帮助

1.bash用户

  1. echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.bash_profile
  2. source ~/.bash_profile

2.zsh用户

  1. echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.zshrc
  2. source ~/.zshrc