开发者

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

I'm looking for the configuration file that keeps t开发者_开发百科rack 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.


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.


You can change your MAC OS proxy using below command:-

networksetup -setwebproxy "Your network service name(Airport,Ethernet etc..)" host port

example:-

networksetup -setwebproxy "Ethernet Adaptor (en0)" 122.176.70.186 80

Simply run this command on the terminal.


The settings are stored in /Library/Preferences/SystemConfiguration/preferences.plist. I found out that you have to match up the Sets field with the NetworkServices field. They look like GUIDs.

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜