command-lineproxyosx-lionsystem-preferences

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


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.


Solution

  • 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.