curl: (7) Failed to connect to raw.githubusercontent.com port 443: Connection refused

mac版本:

  

 执行flutter doctor 显示cocoapods已被安装,但是不能用(not working),于是我根据安装指令安装cocoapods,但是安装错误,显示以下报错

curl: (7) Failed to connect to raw.githubusercontent.com port 443: Connection refused

1.打开网站https://www.ipaddress.com/,查询一下 raw.githubusercontent.com对应的IP 地址

2.终端输入sudo vi /etc/hosts,来进行编辑(最新版本没有权限修改hosts文件),输入i进入编辑状态,输入以下内容,然后按esc,最后输入:wq进行保存

199.232.96.133  raw.githubusercontent.com

3.终端输入安装执行,安装 Homebrew

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

4.终端输入

sudo gem install -n /usr/local/bin cocoapods

然后再次输入flutter doctor

终端输入

 sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
  sudo xcodebuild -runFirstLaunch

 解决方法:参考https://blog.csdn.net/qq_43531694/article/details/106862753

  

原文地址:https://www.cnblogs.com/lude1994/p/14084388.html