14

I'm working behind a proxy. When I installed homebrew I've modified the official command:

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

by adding a -x option to tell curl about the proxy:

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

and it works well. But now I want to install openssl:

brew install openssl

and logically, the proxy is not detected:

curl: (7) Failed to connect to homebrew.bintray.com port 443: Connection refused
Error: Failed to download resource "openssl"

If I set the environment variables as described in the documentation:

http_proxy=proxy.mydomain.com:3128
HTTPS_PROXY=proxy.mydomain.com:3128
ALL_PROXY=proxy.mydomain.com:3128

I obtain the same error. Adding http: or https: before doesn't change the problem.

Any ideas?

22

To run Homebrew or Curl behind a proxy :

export ALL_PROXY=$http_proxy:port 

or

export ALL_PROXY=proxyIP:port

After this is done, installation worked smoothly.

  • $http_proxy is not defined usually. – nohillside Mar 28 '16 at 9:40
  • 2
    Setting $ALL_PROXY worked for me. – fgysin Aug 9 '16 at 12:36
  • Depending on the brew command you use, you also have to set the proxy for git with git config --global http.proxy http://proxyuser:proxypwd@proxy.server.com:8080 – Ortomala Lokni Oct 23 '16 at 13:49
4

Try run brew like this:

http_proxy=https://user:password@proxy:port https_proxy=https://user:password@proxy:port brew install PACKAGE

The source is here: https://juanchorossi.com/osx-set-brew-proxy-server/

1
all_proxy=<proxy_domain>:<port> brew install <package>

I didn't explicitly include the http:// or https:// prefix in the proxy domain. Worked for me with macOS Sierra and Homebrew 1.2.4.

0

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .