MAC homebrew安装
homebrew官网:https://brew.sh/
命令行安装
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
可能遇到的问题
1.SSL 443 问题
curl: (7) Failed to connect to raw.githubusercontent.com port 443: Connection refused error
LibreSSL SSL_connect: SSL_ERROR_SYSCALL in connection to github.com:443
产生问题可能的原因
1.网络连接问题:Github的raw文件读取地址遭受DNS污染,导致无法连接到网络。
2.Command line tool问题
解决方案
1.Github的raw文件读取地址遭受DNS污染
在终端中,使用vim修改hosts文件:
sudo vi /etc/hosts
查询IP后,将如下内容添加到hosts文件中:
199.232.4.133 raw.githubusercontent.com
2.重装command line tool
先卸载旧的command line tool:
rm -rf /Library/Developer/CommandLineTools
苹果官网下载,在下载界面搜索command。链接:Sign In - Apple
找一个适合自己电脑的版本,下载安装。
zsh: command not found: brew
编辑配置文件 ~/.zshrc
,加入如下内容:
path=('/opt/homebrew/bin' $path)
export PATH
再执行:
source ~/.zshrc