12

I have tried to do the required search for my problem but I did not get quite the answer I need.

Objective: to install homebrew & work with homebrew OS I am using : OS X El Capitan

The following is my problem: I am new to OS X & Homebrew. I am trying to install homebrew from my home network using the following command:

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

but I get the following error:

curl: (7) Failed to connect to "company_domain_ip" port "port#": Operation timed out

Looks like executing the ruby curl thing is trying to go through the company proxy & port even if I am in my home network. I trying to switch of proxy from Network Preferences > advanced > proxies. But doesn't help.

If I install brew using the ruby curl thing in my office network, then it installs fine. But, brew gives the Bad URI error when I try to do a "brew anything". Not sure if this a brew problem or some problem in the way I am using brew with respect to the proxy.

I think that if I get around this proxy when in non-office on my osx then, it might solve the issue. So how can I switch off http proxy in osx ? so that when I at least run the following command it works first of all.

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Then may be brew will also start working.

Thanks in advance for any help offered.

5 Answers 5

24

setting the ALL_PROXY environment variable helped me with all my cli problems (whether it is npm or homebrew) behind our corporate proxy. Like this:

export ALL_PROXY=https://your.domain.dev:3128

hope it works for you.

7

I solved both my own and likely the OP's issue!
Delete the following file: rm ~/.gitconfig

It turns out it was not ruby or curl remembering the proxy inappropriately, but git itself, and no environment variables can help here.

If you later want to restore it it looks like this:

[http] proxy = http://www.my.proxy.com:80

2
  • This worked for me, although I recommend renaming the .gitconfig file rather than deleting it: mv .gitconfig saved.gitconfig
    – Markku K.
    Nov 19, 2020 at 22:59
  • I deleted proxy related configs from .gitconfig file and that worked for me. Deleting .gitconfig may remove other git related settings. thanks @user2465201 Dec 15, 2020 at 3:39
4

In terminal, type this:

http_proxy=http://IP:PORT https_proxy=http://IP:PORT brew install PACKAGE

for me, was behind IIIT proxy and trying to install python3, so this worked:

http_proxy=http://proxy.iiit.ac.in:8080 https_proxy=http://proxy.iiit.ac.in:8080 brew install python3
2
  • For home use is there any way to make it NOT use ANY proxy? (Since I have no proxy at home and have the identical issue as the OP.) Thanks. Feb 14, 2018 at 15:40
  • I have the same issue as OP, and this cannot solve it, because I have no proxy at home, and I don't know how to set a proxy to DO_NOT_USE. Any help is greatly appreciated. I will try to reinstall Ruby and see if that deletes its memory of the corporate proxy Feb 14, 2018 at 15:43
2

Homebrew is based on Git and Ruby. Underline it uses the proxy configs of Git (contents of .gitcofig). If you want to unset the proxy for Homebrew then just unset the Proxy that Git is using. Two ways to do that

1.Either Delete the lines similar to following. Your system may have different http/socks proxy setting. Your .gitconfig file contents might be different than below

[https]
    proxy = socks5h://127.0.0.1:9090
[http]
    proxy = socks5h://127.0.0.1:9090

2.or you can unset/disable proxy using command line. [This is safer approach]

git config --global --unset http.proxy
git config --global --unset https.proxy
1
  • Thanks, my solution was to find out there was a proxy setting for https and http. Jul 21, 2021 at 13:26
0

For people still experiencing this issue, here's what worked for me :

/usr/bin/ruby -e "$(curl -x 192.168.233.26:3128 -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

-x tells curl about your proxy

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.