在mac系统中,使用homebrew可以很方便的管理包。按照官网的说明执行以下命令时总是报错:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
应该是这个资源访问有问题,那么我们可以尝试使用国内的镜像。给大家推荐一个中科院的镜像站点,里面有各种资源:
https://mirrors.ustc.edu.cn/brew.git
言归正传,开始踩坑
第一步,获取install文件
把官网给的脚本拿下来
curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/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
当然如果这个镜像有问题的话,可以换成别的
第三步,执行脚本
/usr/bin/ruby brew_install
然