Mac os Catalina 快速安装homebrew
直接使用官网给出的安装脚本,安装速度很慢,基本上都是安装超时而失败,使用以下方法即可快速安装。
获取安装脚本
把官网给的脚本拿下来
curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install >> brew_install
修改为国内源
就是把这两句
BREW_REPO = “https://github.com/Homebrew/brew“.freeze
更改为这两句
BREW_REPO = "https://mirrors.ustc.edu.cn/brew.git".freeze
CORE_TAP_REPO = "https://mirrors.ustc.edu.cn/homebrew-core.git".freeze
执行脚本
/usr/bin/ruby brew_install
解决brew:command not found
安装成功后,执行brew update,发现提示brew:command not found
原因:
环境变量未配置
解决:
执行命令
echo 'export PATH=/usr/local/bin:$PATH' >> ~/.bash_profile
source ~/.bash_profile
再执行以下命令
更新
brew update
检查
brew doctor
替换核心软件库
cd /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core
git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git
替换cask软件库
mkdir /usr/local/Homebrew/Library/Taps/caskroom/homebrew-cask
cd /usr/local/Homebrew/Library/Taps/caskroom/homebrew-cask
git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-cask.git
替换 Bottles 源(Homebrew 预编译二进制软件包
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.bash_profile
source ~/.bash_profile
至此安装结束