When I found Making Tor Requests with command-line cURL by NanoDano, I thought I had hit gold!
Easy enough:
Except that when I do:
curl –socks5-hostname localhost:9150 https://check.torproject.org
I get:
curl: (7) Failed to connect to localhost port 9150: Connection refused
Quick answers: Yes, the Tor browser is running, the syntax is correct, ….
I spent several minutes trying to identify the source of the problem before doing this:
curl –socks5-hostname 127.0.0.1:9150 https://check.torproject.org
Success!
Yes, I have a local mis-configuration, which I can correct, but you may find situations where correction isn’t possible.
Try substitution of 127.0.0.1 for localhost and vice-versa, before looking for more obscure causes. (That also quickly identifies this particular mis-configuration.)