1.使用官方链接生成brew_install文件:
curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install >> brew_install
2.修改brew_install 文件中的:
BREW_REPO ="https://github.com/Homebrew/brew".freeze
中的链接更换为中科大源:
BREW_REPO ="git://mirrors.ustc.edu.cn/brew.git".freeze
3.root权限下修改hosts文件:
sudo vi /etc/hosts
增加:
192.30.253.112github.com git
151.101.185.194github.global.ssl.fastly.net
4.开始安装:
/usr/bin/ruby ./brew_install
5.更换中科大homebrew源:
cd "$(brew --repo)"
git remote set-url origin https://mirrors.ustc.edu.cn/brew.git
6.brew update