How to install an homebrew package behind a proxy?
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?
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.
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/
For SOCKS5 proxy:
ALL_PROXY=socks5://127.0.0.1:9001 brew upgrade
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.
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