mac安装Homebrew,提示如下错误curl: (28) Failed to connect to raw.githubusercontent.com port 443 after 75004 ms: Couldn't connect to server
,解决办法如下:
第1步 打开host文件
sudo vim /etc/hosts
第2步 添加IP到上述文件中
199.232.68.133 raw.githubusercontent.com
199.232.68.133 user-images.githubusercontent.com
199.232.68.133 avatars2.githubusercontent.com
199.232.68.133 avatars1.githubusercontent.com
第3步 重新安装软件
前往 https://brew.sh/ 复制安装软件的最新脚本
执行脚本:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
如图:
等待安装执行完成…
首次安装可能会出现如下提示:
Warning: /opt/homebrew/bin is not in your PATH.
Instructions on how to configure your shell for Homebrew
can be found in the 'Next steps' section below.
==> Installation successful!
==> Homebrew has enabled anonymous aggregate formulae and cask analytics.
Read the analytics documentation (and how to opt-out) here:
https://docs.brew.sh/Analytics
No analytics data has been sent yet (nor will any be during this install run).
==> Homebrew is run entirely by unpaid volunteers. Please consider donating:
https://github.com/Homebrew/brew#donations
==> Next steps:
- Run these two commands in your terminal to add Homebrew to your PATH:
(echo; echo 'eval "$(/opt/homebrew/bin/brew shellenv)"') >> /Users/quanxj/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"
- Run brew help to get started
- Further documentation:
https://docs.brew.sh
旨意为添加环境变量,此时若再使用,会提示zsh: command not found: brew
第4步 添加环境变量:
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"') >> /Users/quanxj/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"
第5步 验证是否安装成功
brew --version
出现版本信息,即为安装成功