Failed to connect to raw.githubusercontent.com port 443 & ERROR: Error installing cocoapods: ERRO...

1. mac 安装 homebrew 出错:

Failed to connect to raw.githubusercontent.com port 443: Connection refused error

原因:

由于某些你懂的因素导致GitHub的raw.githubusercontent.com域名解析被污染了。

解决办法:

通过修改hosts解决此问题。

查询真实IP:

在https://www.ipaddress.com/查询raw.githubusercontent.com的真实IP。

修改hosts:

sudo vim /etc/hosts

添加如下内容:

199.232.28.133 raw.githubusercontent.com

2. 升级cocoapods 出现如下错误信息:

ERROR: Error installing cocoapods:
ERROR: Failed to build gem native extension.

如果以下不行的话:

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

(默认大家已经安装了 xcode-select)
xcode-select --install

curl -L https://get.rvm.io | bash -s stable
rvm install ruby-2.6
ruby -v
rvm use ruby-2.6.6
rvm --default use 2.6.6
sudo gem install -n /usr/local/bin cocoapods

你可能感兴趣的:(Failed to connect to raw.githubusercontent.com port 443 & ERROR: Error installing cocoapods: ERRO...)