An easy way to use Tor on OS XJune 5, 2012 in Software
The Tor Project is a nice distributed anonymizing network. The recommended way of running it (I guess) is downloading the Tor browser bundle, which contains Tor itself and a built-in copy of Firefox, but that is overcomplicated and doesn’t let you use your own browser. Of course, you can still use your browser with the Bundle if you set up the proxy server correctly, but it doesn’t make the process more transparent.
That’s why I cooked up a script (a snippet, really) that lets you run Tor from the command line.
First off, you have to install Tor. It’s in Homebrew, fortunately, so run
brew install tor and you’re all set. Do not install Tor as a daemon (as Homebrew recommends), because this is unnecessary.
Now you can run tor with a single
tor command, but you’d still have to switch proxy settings back and forth on your own. Why do that when OSX has a nice
networksetup utility that can change them from a script?
#!/bin/bash INTERFACE=Wi-Fi networksetup -setsocksfirewallproxy $INTERFACE 127.0.0.1 9050 off networksetup -setsocksfirewallproxystate $INTERFACE on tor networksetup -setsocksfirewallproxystate $INTERFACE off
This script sets up the system-wide proxy config to use Tor, and then launches Tor itself. When you’re done with your anonymous browsing activity, Ctrl+C the Tor server, and then the proxy will be disabled automatically.
networksetup to ask for your password (or sometimes not).
INTERFACE variable if you’re using a connection other than Wi-Fi; run
networksetup -listallnetworkservices for a list of available connection names.
(I’m only using Tor because Shamus’ Young’s website considers some Ukrainian IPs as botnets and 403’s access from my home provider. Shame on you, Shamus.)
Liked the post? Treat me to a coffee