Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

On my laptop I usually have a ssh connection open and use the remote machine as a proxy server just so that all my network traffic is over ssh. I know that it's hopeless and we're all doomed, but it makes me feel a little better.

Problem is sometimes I need to set and unset it for some reason and then I have to dig through millions of dialogs to get to here...

enter image description here

...so that I can uncheck that option.

Is there a faster way to do that or a way I can set up a script to turn "SOCKS Proxy" on and off? Probably something with Applescript, right?

Is there a way to do this without learning Applescript?

share|improve this question
    
This method is really inefficient, btw. You are tunnelling TCP over TCP, and it slows things down a lot. Check SSHuttle for one solution, or use a vpn. –  chiggsy Dec 1 '12 at 13:53
add comment

2 Answers 2

up vote 5 down vote accepted

Set up two locations - one with proxy one - one off - you are an Apple menu item away from the switch.

Apple Menu

Just select network, then edit the locations.

networklocation

share|improve this answer
add comment

If you use Alfred, you can try a variant of this extension:

e=$(networksetup -getsocksfirewallproxy wi-fi | grep "No")

if [ -n "$e" ]; then
  echo "Turning on proxy"
  networksetup -setsocksfirewallproxystate wi-fi on
else
  echo "Turning off proxy"
  networksetup -setsocksfirewallproxystate wi-fi off
fi

For more information, look up the networksetup command line function. (Note that you may need to change wi-fi above to something else -- ethernet for wired connections, or airport if you're on Snow Leopard.)

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.