1

I'm failing to make every command in terminal (and ideally every MacOS app) to connect via TOR network by default in MacOS.

A simple test works when I expicitly request to use TOR proxy:

curl --socks5 localhost:9050 --socks5-hostname localhost:9050 -s https://check.torproject.org/ | cat | grep -m 1 Congratulations | xargs
Congratulations. This browser is configured to use Tor.

...but fails if I don't specify any proxy at all:

$ curl -s https://check.torproject.org/ | cat | grep -m 1 Sorry | xargs
Sorry. You are not using Tor.

I'm using VPN set in MacOS System Preferences; I'm on High Sierra 10.13.6.

This is what I've tried to make it work:

  • manually adding Advanced > Socks > Proxies > SOCKS > localhost:9050 to VPN and/or current Internet service (Wi-Fi) for current Network Location
  • manually creating a full clone of current Network Location and setting it up the same way
  • running . torsocks on in the Terminal window where I later run curl
  • running tor per se in a separate Terminal window; running brew services start tor

Using a script suggested at kremalicious results in:

$ INTERFACE=Automatic
$ sudo networksetup -setsocksfirewallproxy $INTERFACE 127.0.0.1 9050 off
Password:
** Error: The parameters were not valid.

$ sudo networksetup -setsocksfirewallproxystate $INTERFACE on
** Error: Unable to find item in network database.

Using torify results in error:

(torify curl -s https://check.torproject.org) | grep Congratulations
ERROR: /usr/bin/curl is located in a directory protected by Apple's System Integrity Protection.
0

Since you didn't mention it, I will suggest you edit your torrc configuration file. Ideally, you should have a line which looks like this:

SocksPort 9050
| improve this answer | |
  • I just created such file with such a line, it didn't help. And, as I mentioned, if I specify for curl which host and port to use as proxy, it works just fine: curl --socks5 localhost:9050 --socks5-hostname localhost:9050 -s https://check.torproject.org/ => Congratulations. This browser is configured to use Tor. – wass rubleff Oct 15 '19 at 1:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.