MAC 安装brew[更新日期 20220428]

安装Homebrew

转载自:macOS安装Homebrew遇到错误LibreSSL SSL_connect: SSL_ERROR_SYSCALL in connection to github.com:443 - CODEBLOG

官方提供了针对各操作系统的一键安装脚本git仓库地址:GitHub - Homebrew/install: 📥 Homebrew (un)installer

针对macOS,只需在terminal中运行:

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

LibreSSL SSL_connect: SSL_ERROR_SYSCALL

在执行该安装脚本是遇到错误:

 

fatal: unable to access 'https://github.com/Homebrew/homebrew-core/': LibreSSL SSL_connect: SSL_ERROR_SYSCALL in connection to github.com:443

fatal: ambiguous argument 'refs/remotes/origin/master': unknown revision or path not in the working tree.

Use '--' to separate paths from revisions, like this:

'git <command> [<revision>...] -- [<file>...]'

解决:由于在中国大陆网络的问题,为git添加socks代理

 

macos@wangs-MacBook-Air % tee ~/.gitconfig <<HERE

heredoc> [http]

sslBackend = openssl

proxy = socks5://127.0.0.1:1089

heredoc> HERE

添加该文件后,如果再次尝试运行安装脚本,会遇到错误

error: Not a valid ref: refs/remotes/origin/master

 

HEAD is now at 94ce3236a Merge pull request #11263 from Bo98/upgrade-source

error: Not a valid ref: refs/remotes/origin/master

fatal: ambiguous argument 'refs/remotes/origin/master': unknown revision or path not in the working tree.

Use '--' to separate paths from revisions, like this:

'git <command> [<revision>...] -- [<file>...]'

^Cfatal: index-pack failed

Failed during: /usr/local/bin/brew update --force --quiet

解决:这是由于多次重复安装造成冲突,需要执行卸载然后再次安装

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

还需要手动删除两个目录

 

sudo rm -rf /usr/local/Homebrew

sudo rm -rf /usr/local/var/homebrew

卸载成功。

现在再次执行安装脚本即可成功安装。

Q.E.D. 

需要梯子

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值