Mac 安装 homebrew 失败的记录

收到苹果官方的邮件去Apple实体店检修了硬盘,结果系统重装,东西都没了。

上次回来之后开始安装各种环境和软件,结果,homebrew一直安装不成功。今天在帅帅的指导下弄好了,下面记录一下经过...

【前倾提要】

Mac系统:macOS Mojave -v 10.14.2

按照 homebrew官网 的方式安装,提示的错误如下:

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

==> This script will install:

/usr/local/bin/brew

/usr/local/share/doc/homebrew

/usr/local/share/man/man1/brew.1

/usr/local/share/zsh/site-functions/_brew

/usr/local/etc/bash_completion.d/brew

/usr/local/Homebrew

 

Press RETURN to continue or any other key to abort

==> Downloading and installing Homebrew...

fatal: unable to access 'https://github.com/Homebrew/brew/': transfer closed with outstanding read data remaining

Failed during: git fetch origin master:refs/remotes/origin/master --tags --force

【解决办法】

参考了官方github的issue,有人也遇到了相同的问题:

https://github.com/Homebrew/legacy-homebrew/issues/46717

解决办法是:

1、自选一个homebrew的版本库,将其代码clone到本地,终端命令如下:

git clone https://github.com/Homebrew/homebrew.git /tmp/homebrew

2、clone到本地后,可尝试运行homebrew查看版本的命令,命令如下:

brew -v

若提示版本号,则表示本地自动安装成功,若未提示,在执行第三步

3、执行官方安装脚本的命令:

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

到此,再尝试第二步查看homebrew的版本,见如下提示则表示成功安装,问题解决:

原文地址:https://www.cnblogs.com/lxmajs/p/10244743.html