Sheharyar Naseer

Installing TSocks (TorSocks) on MacOSX


I recently came across this nifty little terminal app called TSocks that allows you to use a Socks Proxy for your terminal commands. I already use Tor for all other web communications on my Macbook Air, so I wanted to be able to use Tor for my terminal commands as well. You can download and install it via MacPorts or Homebrew or you can build it manually. Sadly, the TSocks Project is no longer maintained. So I set out to find a recent fork or a modified version that would work, and after 10 minutes into my quest I found TorSocks. It was a customized version of TSocks, specfically built to work with Tor out of the box and since Tor was the real reason I wanted to use TSocks in the first place, this was perfect for me. I didn’t need to customize anything, I just installed it and started using it.

Installation

You can install TorSocks via MacPorts but I personally like to use Homebrew:

$ brew install tor            # required depencency
$ brew install torsocks
$ brew install wget

Usage

Usage is fairly simple. First start Tor using the commandline or the Vidalia GUI, then use torsocks, usewithtor or torify commands to execute any other command that connects to the internet. One thing that pisses me off is that the ping command doesn’t work with it.

$ torify wget google.com
$ torsocks wget google.com
$ usewithtor wget google.com

You’ll see that the file will be downloaded. Not Satisfied? You can check your IP using the following commands:

$ curl icanhazip.com               # Your Original IP
$ torsocks curl icanhazip.com      # Your IP over Tor

Happy (Anonymous) Surfing!