1、删除旧Homebrew
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
2、下载新Homebrew安装脚本
curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install >> brew_install
3、编辑brew_install文件(ustc源是中国科学技术大学)
1#BREW_REPO = "https://github.com/Homebrew/brew".freeze 2BREW_REPO = "git://mirrors.ustc.edu.cn/brew.git".freeze
4、替换homebrew-bottles(二进制预编译包)地址
1echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.bash_profile 2source ~/.bash_profile
5、执行brew_install脚本
/usr/bin/ruby ./brew_install
看到如下内容即安装成功
1==> Installation successful! 2 3==> Homebrew has enabled anonymous aggregate formulae and cask analytics. 4Read the analytics documentation (and how to opt-out) here: 5 https://docs.brew.sh/Analytics 6No analytics data has been sent yet (or will be during this `install` run). 7 8==> Homebrew is run entirely by unpaid volunteers. Please consider donating: 9 https://github.com/Homebrew/brew#donations 10==> Next steps: 11- Run `brew help` to get started 12- Further documentation: 13 https://docs.brew.sh