I installed tor and torsocks on OS X 10.11 with brew and then ran tor.
$ brew up
$ brew install tor torsocks
$ tor --version
Tor version 0.2.7.6.
$ torsocks --version
Torsocks 2.1.0
$ tor
In another terminal window, I checked that the connection to the tor network was OK.
$ curl --socks5-hostname localhost:9050 https://check.torproject.org/api/ip
{"IsTor":true,"IP":"81.209.35.112"}
However, when I tried to use torsocks, it didn't work.
$ torsocks curl https://check.torproject.org/api/ip
{"IsTor":false,"IP":"XX.XXX.XX.XXX"}
I noticed that torsocks is a shell script and tried to reproduce its behaviour with the following commands but it didn't work either.
$ export DYLD_INSERT_LIBRARIES=/usr/local/Cellar/torsocks/2.1.0/lib/torsocks/libtorsocks.dylib
$ export DYLD_FORCE_FLAT_NAMESPACE=1
$ curl https://check.torproject.org/api/ip
{"IsTor":false,"IP":"XX.XXX.XX.XXX"}
What can I do to debug this problem?
Edit: the IP address returned by https://check.torproject.org is mine, ie. torsocks curl https://check.torproject.org/api/ip and curl https://check.torproject.org/api/ip return exactly the same output
Edit: tor log
$ tor
Jan 14 17:16:34.173 [notice] Tor v0.2.7.6 running on Darwin with Libevent 2.0.22-stable, OpenSSL 1.0.2e and Zlib 1.2.5.
Jan 14 17:16:34.174 [notice] Tor can't help you if you use it wrong! Learn how to be safe at https://www.torproject.org/download/download#warning
Jan 14 17:16:34.175 [notice] Configuration file "/usr/local/etc/tor/torrc" not present, using reasonable defaults.
Jan 14 17:16:34.180 [notice] Opening Socks listener on 127.0.0.1:9050
Jan 14 17:16:34.000 [notice] Parsing GEOIP IPv4 file /usr/local/Cellar/tor/0.2.7.6/share/tor/geoip.
Jan 14 17:16:34.000 [notice] Parsing GEOIP IPv6 file /usr/local/Cellar/tor/0.2.7.6/share/tor/geoip6.
Jan 14 17:16:34.000 [notice] Bootstrapped 0%: Starting
Jan 14 17:16:34.000 [notice] Bootstrapped 80%: Connecting to the Tor network
Jan 14 17:16:35.000 [notice] Bootstrapped 85%: Finishing handshake with first hop
Jan 14 17:16:35.000 [notice] Bootstrapped 90%: Establishing a Tor circuit
Jan 14 17:16:35.000 [notice] Tor has successfully opened a circuit. Looks like client functionality is working.
Jan 14 17:16:35.000 [notice] Bootstrapped 100%: Done