简单记录一下自己在安装Homebrew的步骤及过程中所遇到的一些报错解决方案
1. 在Terminal中复制Homebrew的安装命令:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
2. 遇到的一些报错情况
-curl: (7) Failed to connect to raw.githubusercontent.com port 443: Connection refused
解决方法:
①打开https://www.ipaddress.com/
②查询 raw.githubusercontent.com 对应的ip地址,获得IP: 185.199.108.133
③Terminal输入:sudo vi /etc/hosts,按i进入编辑,输入以下内容,然后esc退出,:x保存。
#githubhomebrew
查到的ip地址 raw.githubusercontent.com
④重复步骤1,执行安装brew的命令
ps:查看hosts的命令行:cat /etc/hosts
-无法访问github Homebrew-core
解决方法:
①打开https://www.ipaddress.com/
②查询 github.com 对应的ip地址,获得IP: 140.82.114.3
③同上修改hosts的方法,添加github.com的IP
④重复步骤1,执行安装brew的命令
-报错:fatal: unable to access 'https://github.com/Homebrew/homebrew-core/': LibreSSL SSL_connect: SSL_ERROR_SYSCALL in connection to github.com:443
解决方法:
①查看网络设置里当前网络socks代理服务器的IP和端口号,如无修改,默认应为127.0.0.1:1086
②添加git全局配置:
可以在终端先运行如下命令查看当前git配置
cat ~/.gitconfig
看是否有如下两项配置
http.proxy=socks5://127.0.0.1:1086
http.sslbackend=openssl
如果没有,在终端分别运行如下两条命令添加配置:
git config --global http.sslBackend "openssl"
git config --global http.proxy "socks5://127.0.0.1:1086"
再次查看gitconfig的配置,确认已有上述的配置项
ps:恢复gitconfig默认配置命令
git config --global --unset http.proxy
③重复步骤1,执行安装brew的命令