Andy Jarrett // Code. Develop. Manage.

Turning SOCKS proxy on from the terminal on OSX

If you have to set up a SSH tunnel and a SOCKS proxy regularly to get around work firewalls (so you can post on your "blog") you can actually do this from the Terminal.app with the following setup and command

First go to System Preferences and setup you SOCKS server address

Then to turn this on and off from the terminal you can use: networksetup -setsocksfirewallproxystate Ethernet on and networksetup -setsocksfirewallproxystate Ethernet off

To be even lazier you can setup your tunnel with the following one line string (replace 10.0.0.1 with you server address):
ssh -ND 9999 [email protected] && networksetup -setsocksfirewallproxystate Ethernet on


I’m here, learning and working away. If you liked this content and want to keep me going, consider buying me a coffee.
Your support keeps this site running and the coffee brewing! ☕️