Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 879
matpie Avatar asked Jul 22 '11 21:07

matpie


People also ask

How do I find my proxy terminal Mac?

On your Mac, choose Apple menu > System Preferences, then click Network . In the list, select the network service you use—for example, Ethernet or Wi-Fi. Click Advanced, then click Proxies.


2 Answers

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.

like image 62
cjs Avatar answered Oct 24 '22 22:10

cjs


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.

like image 34
Anand Meena Avatar answered Oct 25 '22 00:10

Anand Meena