Mac terminal couldn’t access network

macnetworkingPROXYterminal

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?

Best Answer

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.

Related Question