Skip to content

Instantly share code, notes, and snippets.

@samdmarshall
Last active November 9, 2016 19:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save samdmarshall/7e42c169c95fe8fff189246e13e3fa8c to your computer and use it in GitHub Desktop.
Save samdmarshall/7e42c169c95fe8fff189246e13e3fa8c to your computer and use it in GitHub Desktop.

Install Homebrew

Installation instructions: here

Install Tor

$ brew install tor

Enabling the default config file

sudo mv /usr/local/etc/tor/torrc.sample /usr/local/etc/tor/torrc

Setup Automatic SOCKS proxy

This will take a few steps, you may want to setup a script to handle doing these things for you automatically:

Get Primary network interface Service Identifier

service_identifier=`printf "open\nget State:/Network/Global/IPv4\nd.show" | scutil | grep "PrimaryService" | awk '{print $3}'`

Get the Primary network interface Name

service_name=`printf "open\nget Setup:/Network/Service/$service_identifier\nd.show" | scutil | grep "UserDefinedName" | awk -F': ' '{print $2}'`

Add the SOCKS proxy settings

sudo networksetup -setsocksfirewallproxy "$service_name" localhost $tor_port (by default the tor port is 9050)

Enable the SOCKS proxy

sudo networksetup -setsocksfirewallproxystate "$service_name" on

Run tor automatically

based on the instructions when installing tor, you will want to run brew services then brew services start tor so that it gets automatically started with your computer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment