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:
While on macOS, the results are the same with or without Torsocks:
I also used Wireshark with the filter
ip.addr == 22.214.171.124
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
I installed Torsocks in the following way:
brew install torsocks
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.
I tried to install httpie as explained here, but without success.
pip install httpie