- 网速尚可,可使用此方法官网安装Homebrew
/usr/bin/ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)”
- 网速慢处理方案
先获取install文件 curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install >> brew_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 = “https://mirrors.ustc.edu.cn/brew.git “.freeze
CORE_TAP_REPO = “https://mirrors.ustc.edu.cn/homebrew-core.git“.freeze
注意:
新版本HomeBrew可能没有CORE_TAP_REPO这句代码,如果没有不用新增。
执行脚本
/usr/bin/ruby brew_install
1.替换homebrew bottles默认源
echo ‘export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles’>> ~/.bash_profile
source ~/.bash_profile
2.Homebrew镜像替换为中科大源(即brew update时所更新内容)
cd $(brew --repo)
git remote set-url origin https://mirrors.ustc.edu.cn/brew.git
cd $(brew --repo)/Library/Taps/homebrew/homebrew-core
git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git
cd $(brew --repo)/Library/Taps/caskroom/homebrew-cask
git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-cask.git
brew update