安裝brew遇到如下報錯信息:
ruby brew_install.rb
Warning: The Ruby Homebrew installer is now deprecated and has been rewritten in
Bash. Please migrate to the following command:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
curl: (7) Failed to connect to raw.githubusercontent.com port 443: Connection refused
有兩種解決辦法:
第一種:
先在瀏覽器輸入這個地址:https://raw.githubusercontent.com/Homebrew/install/master/install
打開上面那個網址之後,將網頁的內容保存爲brew_install.rb
,位置不固定,隨便;
然後輸入curl
命令,輸出:curl: try 'curl --help' or 'curl --manual' for more information
,有這個就說明沒有問題了;最後再輸入ruby brew_install.rb
第二種:
由於某種原因,導致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
歡迎關注我的微信公衆號,裏面有很多幹貨,各種面試題