5

I can’t get Torsocks to work properly on macOS 12.3 Monterey, while it works perfectly on Raspbian 11 Bullseye. The program seems to work, but it doesn’t torify the traffic. The version is Torsocks 2.3.0 on both systems.

To do the test, I use the same command twice, with and without Torsocks. This command queries the torproject.org API and returns a flag that indicates whether the traffic is torified and the public IP address:

wget -qO- https://check.torproject.org/api/ip | xargs echo
torsocks wget -qO- https://check.torproject.org/api/ip | xargs echo

On Raspbian, I get the expected results:

{IsTor:false,IP:111.111.11.11}
{IsTor:true,IP:222.222.22.22}

While on macOS, the results are the same with or without Torsocks:

{IsTor:false,IP:111.111.11.11}
{IsTor:false,IP:111.111.11.11}

I also used Wireshark with the filter ip.addr == 116.202.120.181 and the result is consistent, i.e. Wireshark does not detect traffic to this IP when Torsocks is used on Raspbian, but it still detects it on macOS.

I also tried with the Tor service started, but without success:

brew install tor
brew services restart tor
brew services list

Notes

Tor installation

I installed Torsocks in the following way:

On macOS

brew install torsocks

On Raspbian

sudo apt-get install -y torsocks

Other unsuccessful attempts

As suggested on this page, I also tried to use the homebrew version of curl:

torsocks /opt/homebrew/Cellar/curl/7.83.0/bin/curl https://check.torproject.org/api/ip

And also the homebrew version of wget:

torsocks /opt/homebrew/Cellar/wget/1.21.3/bin/wget -qO- https://check.torproject.org/api/ip | xargs echo

Note that the version of curl that ships with macOS is protected and does not work with Torsocks:

torsocks curl https://check.torproject.org/api/ip 
ERROR: /usr/bin/curl is located in a directory protected by Apple's System Integrity Protection.

I also tried to use port 9150 instead of the default 9050 as suggested here:

torsocks --port 9150 -d wget -qO- https://check.torproject.org/api/ip | xargs echo

Note that the -d flag is very useful to see what is going on under the hood and to check where the configuration file is located.

macOS

/opt/homebrew/Cellar/torsocks/2.3.0/etc/tor/torsocks.conf

Raspbian

/etc/tor/torsocks.conf

Edit 2022-05-22

I tried to install httpie as explained here, but without success.

pip install httpie

Edit 2023-05-19

I didn’t find a way to make Torsocks works under macOS 12 and 13, but a workaround is to use programs that can be configured to use Socks5 Proxies. For example, curl can do this. You can connect to the tor proxy on port 9050 or the Tor Browser proxy on port 9150 (Tor Browser must be running).

curl --proxy socks5h://localhost:9150 https://check.torproject.org/api/ip
# {IsTor:true,IP:222.222.22.22}
5
  • Hi nico, I am facing same problem. Hopefully someone will be able to help. Commented Sep 5, 2022 at 20:53
  • Hi Jakub. It is probably related to Apple SIP (System Integrity Protection). From what I understand, it is possible to make Torsocks work by disabling SIP entirely but I don’t like the idea, so I didn’t try it. The goal is to find a way to disable SIP for Torsocks only. en.wikipedia.org/wiki/System_Integrity_Protection
    – nico
    Commented Sep 7, 2022 at 6:18
  • 1
    I see it the same way, I don’t want to desible SIP. One way was to install additional version of program with wich you want use the Torsocks (using brew or pip for example). This way I am not getting the error, but it still does not work for me. (I guess it is same for you, but others were able to get it working this way) Commented Sep 8, 2022 at 8:51
  • There is a pending issue in the repo of the Torsocks project (torsocks doesn't work on Mac OS Monterey and higher).
    – nico
    Commented May 19, 2023 at 11:01
  • I just encountered this issue in trying to torify ssh to get access to my home machine behind ISP NATs. DYLD hooks don't work on system binaries; sudo port install openssh and then using that ssh did indeed work.
    – Landak
    Commented Mar 13 at 11:38

1 Answer 1

1

Monterey changed the way of DYLD hooking, here is a similar issue: https://github.com/rofl0r/proxychains-ng/issues/409

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .