How to install an homebrew package behind a proxy

homebrewPROXY

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?

Best Answer

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.