torsocks not working in El Capitan
Just a few weeks ago on OS X Yosemite, it worked fine. Now, after performing a clean install of OS X El Capitan it no longer works. I’m very inclined to believe something in El Capitan is the culprit since it doesn’t work on two different computers but I can get it to work right now by doing it in a Yosemite VM guest inside an El Capitan host.
Using Homebrew, I install tor
and torsocks
:
brew install tor torsocks
Installation goes fine. I then copy over the sample torrc
and add ExitNodes
cp "$(brew --prefix)/etc/tor/torrc.sample" "$(brew --prefix)/etc/tor/torrc"
echo 'ExitNodes {es}' >> "$(brew --prefix)/etc/tor/torrc"
I start tor
tor &
Everything goes OK
Oct 16 01:18:50.101 [notice] Tor v0.2.6.10 (git-58c51dc6087b0936) running on Darwin with Libevent 2.0.22-stable, OpenSSL 1.0.2d and Zlib 1.2.5.
Oct 16 01:18:50.101 [notice] Tor can't help you if you use it wrong! Learn how to be safe at https://www.torproject.org/download/download#warning
Oct 16 01:18:50.102 [notice] Read configuration file "/usr/local/etc/tor/torrc".
Oct 16 01:18:50.104 [notice] Opening Socks listener on 127.0.0.1:9050
Oct 16 01:18:50.000 [notice] Parsing GEOIP IPv4 file /usr/local/Cellar/tor/0.2.6.10/share/tor/geoip.
Oct 16 01:18:50.000 [notice] Parsing GEOIP IPv6 file /usr/local/Cellar/tor/0.2.6.10/share/tor/geoip6.
Oct 16 01:18:50.000 [notice] Bootstrapped 0%: Starting
Oct 16 01:18:50.000 [notice] Bootstrapped 5%: Connecting to directory server
Oct 16 01:18:50.000 [notice] Bootstrapped 80%: Connecting to the Tor network
Oct 16 01:18:50.000 [notice] Bootstrapped 85%: Finishing handshake with first hop
Oct 16 01:18:51.000 [notice] Bootstrapped 90%: Establishing a Tor circuit
Oct 16 01:18:52.000 [notice] Tor has successfully opened a circuit. Looks like client functionality is working.
Oct 16 01:18:52.000 [notice] Bootstrapped 100%: Done
Then I try to use torsocks
to check if everything is fine
torsocks curl -s https://check.torproject.org | grep Congratulations
No message, which means it isn’t working. I also try to check my IP
torsocks curl http://ipecho.net/plain
It confirms it isn’t working, by showing my real IP.
I also tried various other commands and apps, as well as different ExitNodes
(including none at all) and different configurations. Nothing seems to do the trick. It works correctly on Yosemite, and I do nothing differently. Since there isn’t an actual error shown, this is difficult to diagnose.
As a further note (not sure how relevant it is), torsocks show
outputs
DYLD_INSERT_LIBRARIES=""
And here are the Dependencies
part of brew info tor
==> Dependencies
Required: libevent ✔, openssl ✔
Optional: libnatpmp ✘, miniupnpc ✘, libscrypt ✘
and brew info torsocks
==> Dependencies
Build: autoconf ✔, automake ✔, libtool ✔
To note that torsocks
is the one that doesn’t work. tor
by itself does, when configured in System Preferences. This can also be confirmed with curl
, by doing curl --socks5 127.0.0.1:9050 http://ipecho.net/plain
.
The problem doesn't appear to be in "tor" or "torsocks". The problem seems to be in the version of "curl" shipped with El Capitan.
Similar to yourself if I try torsocks curl -s https://check.torproject.org | grep Congratulations
I get nothing back.
However if I try torsocks wget -qO- https://check.torproject.org | grep Congratulations
I get the expected replies.
Congratulations. This browser is configured to use Tor.
Congratulations. This browser is configured to use Tor.
But if you install curl from brew (resulting in a newer version of curl than ships with El Capitan) and then run torsocks /usr/local/Cellar/curl/7.45.0/bin/curl -s https://check.torproject.org | grep Congratulations
, you get the expected "Congratulations" messages (note the version number might be different by the time you try this).
Congratulations. This browser is configured to use Tor.
Congratulations. This browser is configured to use Tor.