Apple - Is there any shortcut/easy way to switch this system proxy settings?

This can be done with networksetup.

Get all services:

networksetup -listallnetworkservices

Then with the proper service (e.g Ethernet or the name of your USB 10/100/1000 LAN adapter) enter

sudo networksetup -setsocksfirewallproxy <networkservice> <domain> <port number> <authenticated> <username> <password>

or

sudo networksetup -setwebproxy <networkservice> <domain> <port number> <authenticated> <username> <password>

to configure it (which isn't necessary in your case, because you already entered all necessary values).

e.g.

sudo networksetup -setsocksfirewallproxy Ethernet 127.0.0.1 18080
sudo networksetup -setwebproxy Ethernet 127.0.0.1 18080

To simply toggle it on or off use:

sudo networksetup -setsocksfirewallproxystate networkservice on | off
sudo networksetup -setwebproxystate networkservice on | off

e.g.

sudo networksetup -setsocksfirewallproxystate Ethernet off
sudo networksetup -setwebproxystate Ethernet off

man networksetup will reveal other proxy options (gopher, ftp, etc.)


Use "Locations" under Network Preferences.

enter image description here

Set up a location that has the proxy and then a location that doesn't. When you want to use the proxy, pick that location and your settings will change.

Tags:

Macos

Proxy