由于国内的原因,Mac下brew总是无法安装,在第一步获取安装文件时就一直卡死。
安装方法
- 下载安装文件
使用下载工具下载安装文件。地址如下:
https://raw.githubusercontent.com/Homebrew/install/master/install
假设下载下来的文件名时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
- 运行安装文件
ruby install
可能会很久,耐心
- 安装成功后,替换brew源
cd "$(brew --repo)"
git remote set-url origin git://mirrors.ustc.edu.cn/brew.git
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin git://mirrors.ustc.edu.cn/homebrew-core.git
网友评论