For every new session in OS X terminal, I have to make my proxy settings again. I do this by entering the command

export http_proxy="username:password@ip address:port number"

Is there a way to make these proxy settings once for all?

  • What proxy settings? What commands do you use? – mmmmmm Feb 8 '16 at 1:27
  • with regard to internet. export http_proxy="username:password@ip address:port number" – curio17 Feb 13 '16 at 9:27

Your http proxy (just for some web sites not https ones and not for the rest of the internet) can be set for each terminal session by adding the line

export http_proxy="username:password@ip address:port number"

to your ~/.bash_profile file

Note this will only affect command line programs.


To globally set an http proxy system-wide on MacOS (not just for a terminal session) you can use:

networksetup -setwebproxy wi-fi localhost 8080
networksetup -setwebproxystate wi-fi on

This assumes your network interface is called wi-fi (or Wi-Fi), and that your proxy is running on localhost on port 8080.

To disable the proxy:

networksetup -setwebproxystate wi-fi off

This is equivalent to setting the proxy via mac system settings > Network > wi-fi > Advanced > Proxies > Web proxy.

If you need a GUI wrapper for this command check out this answer. The bitbar script linked in the answer also contains the commands for setting a SOCK5 or PAC proxy.


I'm assuming you mean aliases, not proxys.

Add it to ~/.bashrc and ~/.bash_profile. See this guide for more depth. I don't believe OS X supports a ~/.bash_aliases file.

  • 1
    No bash directly supports ~/.bash_aliases you call it from ~/.bashrc (which you probably should call from ~..bash_profile as well) – mmmmmm Feb 8 '16 at 1:27
  • @Mark Fair, but (to my limited knowledge) some systems do so automagically which makes it easy. – JMY1000 Feb 8 '16 at 3:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .