homebrew 安装踩坑解决过程

Homebrew

由于国外镜像不FQ的安装的话基本就会被qiang,所以按照官网的方式去安装会有error: RPC Failed错误

可以将安装的文件下载到本地,通过修改国内源去安装;

下载源到本地

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

修改镜像源

BREW_REPO = "https://github.com/Homebrew/brew".freeze

修改为(如果没有找到的CORE_TAP_REPO的话直接复制)

BREW_REPO = "https://mirrors.ustc.edu.cn/brew.git".freeze
CORE_TAP_REPO = "https://mirrors.ustc.edu.cn/homebrew-core.git".freeze

通过脚本安装brew

直接在控制台输入

/usr/bin/ruby brew_install

这里用的是中科院的源,可能会出现

fatal: early EOF
fatal: index-pack Failed
Error: Failure while executing; `git clone https://github.com/Homebrew/homebrew-core /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core --depth=1` exited with 128.
Error: Failure while executing; `/usr/local/bin/brew tap homebrew/core` exited with 1.
Failed during: /usr/local/bin/brew update --force

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

homebrew-core的镜像地址也设为中科院的国内镜像

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

// 更新
brew update

相关文章

最近做自动化测试时,深感自己对前端涉猎太少,加上对这块比...
homebrew本身就是一个git仓库。使用homebrew安装软件包时,会...
一、Homebrew安装、卸载等命令Homebrew的安装和卸载都非常简...
在mac系统中,使用homebrew可以很方便的管理包。按照官网的说...
我按照说明从这里使用brew安装mysqlhttps://gist.github.com...
我在macOS10.12.4上安装了nginx1.10.3和php5.5.38作为开发服...