微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐