How to connect to the internet from Terminal when using a proxy with authentication I have to use proxy servers to connect to the internet. I have set all proxies in my system proxy settings. Now I can connect to Internet using my browser and applications.

But I cannot connect to internet from my terminal.

I tried

export http_proxy="http://username:password@proxyserver:port/" 


But still terminal applications cannot connect to the internet.
Terminal does not use proxy settings configured in the network preferences pane because it doesn't do any connection. Terminal just let you fire commands which will use the network in different ways.

When setting your http_proxy and https_proxy environment variables should not include the http: or https: prefixes.

Therefore the environment variable in your case should read:

http_proxy=username:password@proxyserver:port


Note: many old programs have issues with connecting through proxy servers which require authentication before connecting.

Additional Tip:

Due to our infrastructure we found it much easier to have users run SquidMan locally and have it configured to connect to our main proxy. This allows the local machine to act as a proxy directly, and eliminates a lot of authentication issues etc when using proxy servers on Mac machines, especially in a mixed and AD environments.

In the case of using this method our http_proxy and https_proxy would be:

http_proxy=localhost:3128