I am using an HTTP proxy on MacOS 10.7 (which works for Safari.app, when set in the system preferences). I'm now trying to set the proxy for command-line applications using the $http_proxy environment variable. However, I'm seeing the following error (proxy details replaced by uppercase variables

$ export http_proxy=PROXY:PORT
$ wget http://www.google.com
--2012-01-31 17:31:31--  http://www.google.com/
Connecting to PROXY (PROXY)|PROXY_IP|:PORT... failed: Connection refused.

Any ideas what I might be doing wrong? Thanks!

  • 1
    Do you need a username/password for this proxy? – Daniel Beck Jan 31 '12 at 16:45
  • No, I do not need a username/password – astrofrog Feb 10 '12 at 11:28


I hope this is not a dumb answer but do you have real values for PROXY and PORT. It should normally look something like

export http_proxy=http://myproxy.myorg.com:8080/ 


export http_proxy= 

Also try setting the variable in caps eg.

export HTTP_PROXY=http://myproxy.myorg.com:8080/ 

Finally there is normally some sort of authentication\verification on the proxy for example it might need to be configured to check the source address. Is your address configured on it?


  • I assume he's simply protecting his privacy by replacing actual IP and Ports with PROXY/PORT. – Michael Frank Dec 30 '13 at 2:02

Connection refused indicates that that the given ip address and port are atleast in theory valid but the host is blocking the connection because a) firewall doesnt let your connection to the actual proxy server software or b) there is no proxy server running in that particular host in that particular port.

First line of debugging this would be to use telnet in terminal.

  1. telnet PROXY PORT
  2. telnet PROXY_IP PORT

If both cases fail with "connection refused", problem is in the other (proxy) end or you dont have proper name/ip/port for your proxy.

If either one fails and another works, there's definitely some sort of dns error (which again, you might not be able to fix on your own)

PS. Atleast on linux, typically http and https proxy variables are exported with full urls including the protocol: export http_proxy=http://foo.bar.biz:8080/

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.