Change network proxy settings in via commandline in Mac OS X Lion

matpie picture matpie · Jul 22, 2011 · Viewed 43k times · Source

I'm looking for the configuration file that keeps track of the Network Proxy settings in OS X. Is it stored in a .plist file?

Specifically I'd like to programmatically modify the "Bypass proxy settings for these Hosts & Domains" field.

Answer

cjs picture cjs · Jul 25, 2011

You can use the networksetup command to get and set the proxy bypasses. Excerpts from the man page:

networksetup
  [-getproxybypassdomains networkservice]
  [-setproxybypassdomains networkservice domain1 [domain2] [...]]


  -getproxybypassdomains networkservice
     Displays Bypass Domain Names for <networkservice>.

   -setproxybypassdomains networkservice domain1 [domain2] [...]
     Set the Bypass Domain Name Servers for <networkservice> to <domain1> [domain2] [...]. 

Any
number of Domain Name servers can be specified. Specify "Empty" for to clear all Domain Name entries.