解决Mac安装Homebrew失败

首先使用Homebrew官网的安装shell命令安装:

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

会出现如下错误(或许是网络或者其他原因):

fatal: unable to access 'https://github.com/Homebrew/brew/': LibreSSL SSL_connect: SSL_ERROR_SYSCALL in connection to github.com:443 
Failed during: git fetch --force origin

我试了网上的各种办法,改hosts、git config --global http proxy都不行。我们可以使用gtee代理的下载地址:

/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"

下载选择1,y。

请选择一个下载镜像,例如中科大,输入1回车。
源有时候不稳定,如果git克隆报错重新运行脚本选择源。cask非必须,有部分人需要。
1、中科大下载源 2、清华大学下载源 3、北京外国语大学下载源  4、腾讯下载源(不显示下载进度) 5、阿里巴巴下载源(缺少cask源)  

请输入序号: 1


  你选择了中国科学技术大学下载源
  
!!!此脚本将要删除之前的brew(包括它下载的软件),请自行备份。
->是否现在开始执行脚本(N/Y) y

直至安装完成会发现,环境变量也自动配置好了,brew可以直接使用(brew help试试)。如果不行,先执行下source /Users/zcm/.zprofile。

source /Users/zcm/.zprofile
brew help

本文转载于解决Mac安装Homebrew失败,感谢!

猜你喜欢

转载自blog.csdn.net/zhangjing1019/article/details/127387264