Using Redsocks on Mountain Lion I'm trying to use redsocks on Mountain Lion for system wide SOCKS proxy. How can I configure the iptables on OSX to redirect tcp traffic to redsocks.

The redsocks documentation mentions the following rules -:

# Create new chain
root# iptables -t nat -N REDSOCKS

# Ignore LANs and some other reserved addresses.
# See Wikipedia and RFC5735 for full list of reserved networks.
root# iptables -t nat -A REDSOCKS -d 0.0.0.0/8 -j RETURN
root# iptables -t nat -A REDSOCKS -d 10.0.0.0/8 -j RETURN
root# iptables -t nat -A REDSOCKS -d 127.0.0.0/8 -j RETURN
root# iptables -t nat -A REDSOCKS -d 169.254.0.0/16 -j RETURN
root# iptables -t nat -A REDSOCKS -d 172.16.0.0/12 -j RETURN
root# iptables -t nat -A REDSOCKS -d 192.168.0.0/16 -j RETURN
root# iptables -t nat -A REDSOCKS -d 224.0.0.0/4 -j RETURN
root# iptables -t nat -A REDSOCKS -d 240.0.0.0/4 -j RETURN

# Anything else should be redirected to port 12345
root# iptables -t nat -A REDSOCKS -p tcp -j REDIRECT --to-ports 12345

# Any tcp connection made by `luser' should be redirected.
root# iptables -t nat -A OUTPUT -p tcp -m owner --uid-owner luser -j REDSOCKS
Before 10.7, Mac OS X used IPFW, but it is now deprecated for ipfilter (pfctl) from OpenBSD.

The bug that causes sshuttle to have occasional kernel panics is not with sshuttle, but with IPFW on OSX 10.7 and 10.8, so redsocks will have the exact same issue.

Unfortunately, I don't know enough ipfilter to get it working with redsocks, but if I ever figure it out, I'll definitely share it.