Homebrew安装以及问题处理

Homebrew是一个macOs包管理器,与python包完美结合。安装时,执行命令:

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

执行后发现提示,用

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

代替上述命令。

执行命令,出现443错误,无法连接安装。

根据网上提供的解决办法,主要原因是域名被污染无法正确解析。

先查询 raw.githubusercontent.com 的正确ip地址,可以借助网站www.ipadress.com来查询,然后到

/private/etc/hosts 中,添加 

199.232.68.133  raw.githubusercontent.com,来更改hosts文件。

然后就OK了。

后续执行过程中出现错误:

fatal: unable to access 'https://github.com/Homebrew/homebrew-core/': LibreSSL SSL_read: SSL_ERROR_SYSCALL, errno 54
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

主要是因为镜像的原因:

参考文章: https://www.jianshu.com/p/dee2e61dcb70即可解决。

该文转载内容如下:

-------------------------------------------------------------------------------------

安装 Homebrew 执行完安装语句

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

抛出如下异常

fatal: unable to access 'https://github.com/Homebrew/homebrew-core/': LibreSSL SSL_read: SSL_ERROR_SYSCALL, errno 54
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

解决办法

survivors@sdeMacBook-Pro ~ % git clone git://mirrors.ustc.edu.cn/homebrew-core.git/ /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core --depth=1

Cloning into '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core'...
remote: Counting objects: 5105, done.
remote: Compressing objects: 100% (4904/4904), done.
remote: Total 5105 (delta 44), reused 886 (delta 5)
Receiving objects: 100% (5105/5105), 4.14 MiB | 1.17 MiB/s, done.
Resolving deltas: 100% (44/44), done.
survivors@sdeMacBook-Pro ~ % cd "$(brew --repo)" 
survivors@sdeMacBook-Pro Homebrew % git remote set-url origin https://mirrors.ustc.edu.cn/brew.git
survivors@sdeMacBook-Pro Homebrew % cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
survivors@sdeMacBook-Pro homebrew-core % git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git

survivors@sdeMacBook-Pro homebrew-core % brew update
Already up-to-date.

如上终端中 code 所示,执行如下语句
首先,更换有效的镜像地址;

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

最后,执行完如上操作后,终端显示如下字样内容即可。

Already up-to-date.


作者:survivorsfyh
链接:https://www.jianshu.com/p/dee2e61dcb70
来源:简书
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。

 

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值