Skip to content

Instantly share code, notes, and snippets.

@georgebrock
Created September 29, 2012 20:05
Show Gist options
  • Save georgebrock/3805062 to your computer and use it in GitHub Desktop.
Save georgebrock/3805062 to your computer and use it in GitHub Desktop.
OS X SOCKS proxy script
#!/usr/bin/env bash
# The name of the wireless network has changed between versions of OS X, so we
# need to find the right name:
service=`networksetup -listallnetworkservices | grep -Ei 'wi-fi|airport'`
networksetup -setsocksfirewallproxy $service localhost 9000
networksetup -setsocksfirewallproxystate $service on
echo 'Connecting to proxy.'
echo 'Press ctrl+c when you are done.'
ssh -ND 9000 myserver.example.com
echo 'Disconnecting.'
networksetup -setsocksfirewallproxystate $service off
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment