tsocks: a nifty utility now working on OS X
tsocks is a cool Linux utility. Using LD_PRELOAD, it intercepts calls to the OS’s socket-related functions (connect() and co.), and transparently tunnels them through a SOCKS proxy. Example usage:
$ curl http://www.whatismyip.com/automation/n09230945.asp 89.141.232.202 $ tsocks curl http://www.whatismyip.com/automation/n09230945.asp 159.29.64.14
As it happens, curl supports SOCKS proxies, but tsocks allows you to add support to programs that know nothing about them (like, say, wget).
Sadly, it’s no longer maintained.
Marc Abramowitz got it working on OS X (patch) back in 2006 by switching to DYLD_INSERT_LIBRARIES, among other things, but even this port has succumbed to bit-rot.
So I fixed it up, and the code now lives at github.