My Macbook pro use a proxy server to connect to Internet, and using safari ,I can visit the website. Now I'm installing Macports, and it needs to connect to the internet, but the terminal just can't access Internet... I tried to ping www.google.com or any other sites, all failed. so I guess It's the problem about using proxy server. What should I do to let my terminal conneted with internet?


Most applications that you run from the command line do not use Mac's system proxy. You need to set the variable http_proxy to the proxy. This should let you connect to the internet from applications on the command line. (Note: Some application have there own proxy settings which you might have to look up).

So you could put in ~/.bashrc (or whatever shell config file you are using) the following command.

export http_proxy="<proxy>"

where <proxy> is the address of the proxy.

  • It would likely help, especially with some wonky proxy urls, for the proxy url to my quoted: export http_proxy="<proxy>" – demure May 23 '13 at 5:02
  • Thanks a lot! It's very helpful but still not sovle my problem, I add these lines to my ~/.bash_profile also the ~/.bashrc <br/> export http_proxy= export https_proxy= and run source ./bash_profile but when I want to ping the website, It still failed... – linkbreaker May 23 '13 at 5:56

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.