'Homebrew installation on Mac OS X Failed to connect to raw.githubusercontent.com port 443
When I try to install Homebrew, I am getting following connection refused error. Please help me to solve this problem.
$ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
curl: (7) Failed to connect to raw.githubusercontent.com port 443: Connection refused
Solution 1:[1]
The accepted Answer is outdated now. But based on the answer I solved the problem by:
- open the home page of brew https://brew.sh/
- copy the URL from the install cmd and open it on your browser https://raw.githubusercontent.com/Homebrew/install/master/install.sh
- right-click and save it to your computer
- open a terminal and run it with: /bin/bash path-to/install.sh
Solution 2:[2]
It was a company proxy problem for me and the solution as mentioned here worked for me.
export HTTPS_PROXY=https://<proxy.mycompany>:<port>
git config --global https.proxy $HTTPS_PROXY
git config --global --get https.proxy
Solution 3:[3]
I had the same error,
- Disabled VPN
tried again installing without VPN It worked for me.
Solution 4:[4]
I've seen this a few times on other people's machines and it seems to be fixed after you install xcode, i.e. xcode-select --install
Solution 5:[5]
There are several situations here, you can do following things :
- reinstall the xcode command line tool by
removing the old tools ($ rm -rf /Library/Developer/CommandLineTools)andxcode-select --install - request web page
https://raw.githubusercontent.com/Homebrew/install/master/installthen save it's content to shell file then run it. - change your DNS server to
8.8.8.8(This is worked for me : ] )
Finally you should run /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Solution 6:[6]
These steps solved the problem:
xcode-select --install- restart the Mac
Execute this command:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
and it should work.
Solution 7:[7]
Check is https proxy is set
env|grep -I proxy
Then if it is set, remove the env variable
unset HTTPS_PROXY
Solution 8:[8]
~ % cd /ect/
~ % vim host
199.232.68.133 raw.githubusercontent.com
Solution 9:[9]
I solved this problem by the following steps:
- removing the old tools (
$ rm -rf /Library/Developer/CommandLineTools) - install xcode command line tools again (
$ xcode-select --install).
Solution 10:[10]
Although saving the shell file locally and then running it can solve this problem, but you'll meet it again when you do something similar(e.g. install oh-my-zsh, vim-plug, etc.)
At last, I find the 3rd item of this answer(https://stackoverflow.com/a/61787208/5458745) works best for me, as it can also solve the problem I meet when installing other tools using curl. However instead of changing the DNS, I add 8.8.8.8 to my original DNS server list, which works fine for me.
Change your DNS server to 8.8.8.8 (This is worked for me)
Solution 11:[11]
I solved it.
You can visit https://github.com/Homebrew/install/blob/master/install.sh to get this install.sh by copy the whole contents.
Then paste it into install.sh and run sh install.sh.
Solution 12:[12]
A combination of what @blueskin mentioned first and then what @Ferenc Yim mentioned is what worked for me.
The script also requires sudo access (not necessarily run with a sudo prefix just need admin access)
Solution 13:[13]
If you are behind a proxy, try this:
sudo vim /etc/hosts
#add the line below and :wq
199.232.28.133 raw.githubusercontent.com
Solution 14:[14]
The method of using ruby is probably outdated, as shown below:
As a better alternative, please set your computer's DNS server to 8.8.8.8
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow



