20 July 2015

Mac OSX Auto proxy configuration from the shell

If you are usinf a Mac and you are jumping between multiple proxy these commands may come in handy to switch various proxy setting on and off.

You can of course go in via the Setting GUI, but trust me, after a while it gets a bit old.

The two setting you will most likely want to turn on and off are


  • Auto Proxy Discovery
  • AutoMatic Proxy Configuration


You may also want to explicitly define the two below but auto is where you should be as ti configure a lot of stuff for you including exclusions.


  • Web (HTTP)
  • Secure Web Proxy (HTTPS)



Before you can specify any commands you need to know which network interface or network service you need to use.  To get the list run


sudo networksetup -listallnetworkservices

AutoProxy Discovery 

sudo networksetup -setproxyautodiscovery "Thunderbolt Ethernet" on

or

sudo networksetup -setproxyautodiscovery "Thunderbolt Ethernet" off


Automatic Proxy Configuration

Enable it

sudo networksetup -setautoproxystate "Thunderbolt Ethernet" on

Disable it

sudo networksetup -setautoproxystate "Thunderbolt Ethernet" on


Configure the URL

sudo networksetup -setautoproxyurl "Thunderbolt Ethernet" "http://utm02.domain.co.za:8080/wpad.dat"

Blank it 

sudo networksetup -setautoproxyurl "Thunderbolt Ethernet" " "


To manually specify the proxy

sudo networksetup -setwebproxy "Thunderbolt Ethernet" "webproxy" 8080 

with authentication

sudo networksetup -setwebproxy "Thunderbolt Ethernet" "webproxy" 8080 on username password




set the bypass or exclusions


sudo networksetup -setproxybypassdomains  "Thunderbolt Ethernet" "*.mydomain" "*.otherdomain" "10.0.0.0/8"


No comments:

Post a Comment