macOS Catalina 10.15.1安装homebrew报错 LibreSSL SSL_read: SSL_ERROR_SYSCALL, errno 54

1、更新homebrew

$ brew update
报错:
fatal: unable to access 'https://github.com/Homebrew/brew/': LibreSSL SSL_read: SSL_ERROR_SYSCALL, errno 54
解决方案:
$ cd
$ curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install >> brew_install
$ vim brew_install

进入到brew_install
按 i 进入编辑模式

更改脚本中的资源链接,替换成中国科学技术大学的镜像
	就是把这两句 
	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

改完如下图。
在这里插入图片描述
按ESC退出编辑模式,输入:wq 退出并保存。

$ rm -rf /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
Cloning into '/usr/local/Homebrew/Library/Taps/homebrew/homebrew'...
remote: Counting objects: 656959, done.
remote: Total 656959 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (656959/656959), 213.43 MiB | 2.02 MiB/s, done.
Resolving deltas: 100% (431789/431789), done.
Checking out files: 100% (5104/5104), done.

// 把homebrew-core的镜像地址也设为中科院的国内镜像
$ cd "$(brew --repo)" 
Homebrew $ git remote set-url origin https://mirrors.ustc.edu.cn/brew.git
Homebrew $ cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core" 
-bash: cd: /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core: No such file or directory
报错:

没有这个文件。

解决:

找一下这个目录:
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core
发现这个目录竟然不存在,那我们就来手动创建一个:

$ sudo mkdir  /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core

再执行一遍:

Homebrew $ cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core" 
homebrew-core $ git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git
报错:

还是报homebrew的错误,没办法,卸载了homebrew重新安装吧。

2、卸载homebrew

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

3、再次安装homebrew

$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
报错:
curl: (56) LibreSSL SSL_read: SSL_ERROR_SYSCALL, errno 54
-e:254: unterminated string meets end of file
... "The following existing direct

-e:254: syntax error, unexpected end-of-input, expecting end
解决:

应该是这个资源访问有问题,那么我们可以尝试使用国内的镜像。
给大家推荐一个中国科学技术大学的镜像站点,里面有各种资源:
https://mirrors.ustc.edu.cn/brew.git

继续爬坑

第一步:获取install文件,把官网给的脚本拿下来
$ curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install >> brew_install
第二步:更改脚本中的资源链接,替换成中国科学技术大学的镜像
$ vim brew_install

进入到brew_install
按 i 进入编辑模式

更改脚本中的资源链接,替换成中国科学技术大学的镜像
	就是把这两句 
	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

按ESC退出编辑模式,输入:wq 退出并保存。

这个前面已经做过了,不多解释。

第三步:执行脚本
$ /usr/bin/ruby brew_install
报错:
fatal: unable to access 'https://github.com/Homebrew/brew/': LibreSSL SSL_read: SSL_ERROR_SYSCALL, errno 54
Failed during: git fetch origin master:refs/remotes/origin/master --tags --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)" 
Homebrew $ git remote set-url origin https://mirrors.ustc.edu.cn/brew.git
Homebrew $ cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core" 
homebrew-core $ git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git

4、再次更新homebrew

$ brew update

这次更新成功。

Updated 1 tap (homebrew/core).
==> Updated Formulae
ansible                    fwup                       mlt
auditbeat                  gatsby-cli                 paket
aws-cdk                    ghq                        picard-tools
aws-sdk-cpp                glib                       redis
breezy                     goreleaser                 reminiscence
ccache                     helmfile                   scrcpy
cheat                      jenkins-lts                serverless
clojure                    jhipster                   swagger-codegen
cointop                    kubebuilder                swagger-codegen@2
convox                     lerna                      synscan
darksky-weather            libimobiledevice           telegraf
diamond                    librealsense               tig
docker-compose-completion  libusbmuxd                 tunnel
elasticsearch              libxlsxwriter              wxpython
exploitdb                  lmod                       zstd
folly                      mesa

5、检查homebrew

$ brew doctor

Ps:其实查出一堆Warning,不过不影响使用,这里暂时不细究了。

6、更换homebrew的默认源:

直接使用 Homebrew 还需要更改默认源,不然谁用谁想打人,原因你懂的。
以下是将默认源替换为国内 USTC 源的方法。

替换核心软件仓库
$ cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"

$ git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git
替换 cask 软件仓库(提供 macOS 应用和大型二进制文件)
$ cd "$(brew --repo)"/Library/Taps/caskroom/homebrew-cask

$ git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-cask.git
Bottles 源(Homebrew 预编译二进制软件包)
bash(默认 shell)用户:
$ echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.bash_profile

$ source ~/.bash_profile
zsh 用户:
$ echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.zshrc

$ source ~/.zshrc

参考文章:
macOS Catalina 10.15.1中安装Python3 完全安装攻略
macOS High Sierra10.13.3安装homebrew报错LibreSSL SSL_read: SSL_ERROR_SYSCALL, errno 54解决方法
macOS High Sierra10.13.3安装homebrew报错LibreSSL SSL_read: SSL_ERROR_SYSCALL, errno 54解决方法(和上一篇有一处不同)
Homebrew的安装、卸载和扩展

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

fswy

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值