0

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

0

Your Answer

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

Browse other questions tagged or ask your own question.