Homebrew的安装

Homebrew是一款Mac OS平台下的软件包管理工具。

安装方法:命令行输入

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

但是,此方法一般会因访问外网(github)速度太慢而失败。

因此,我们采用国内的镜像源来安装。

1.获取brew_install文件,用>>将以上链接的下载脚本下载到本地文件上。

curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install >> brew_instal

2.修改此文件内容,将

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(不存在就不管)

3.用ruby(mac自带)运行脚本

/usr/bin/ruby brew_install

若长时间停止执行,并出现

==> Tapping homebrew/core
Cloning into '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core'.

的提示,则执行

git clone git://mirrors.ustc.edu.cn/homebrew-core.git/ /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core --depth=1

最后,通过命令

brew -v

检测是否安装成功。

posted @ 2019-12-20 09:53  罗毅豪  阅读(4512)  评论(1编辑  收藏  举报