苹果系统macOS下使用国内镜像安装Homebrew

苹果系统macOS下使用国内镜像安装Homebrew

修改安装脚本并安装

cd ~
curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install >> brew_install

编辑brew_install文件

注释掉BREW_REPO = "https://github.com/Homebrew/brew".freeze和CORE_TAP_REPO = "https://github.com/Homebrew/homebrew-core".freeze

修改为
BREW_REPO = "git://mirrors.ustc.edu.cn/brew.git".freeze
CORE_TAP_REPO = "git://mirrors.ustc.edu.cn/homebrew-core.git".freeze

安装

/usr/bin/ruby ~/brew_install 

替换homebrew源

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

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

brew update

设置 bintray镜像

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

推荐阅读更多精彩内容