How to Setup Tor on MacOS

Jack Paczos
Get that Data!
Published in
2 min readJan 21, 2024

‎This post shows how you can easily setup tor on your local machine.

When first hearing the words Tor-Browser or Tor Network they might sound a bit intimidating. However it is truly extremely simple to get started.

Steps:

  1. Installing Homebrew
  2. Installing Tor
  3. Start/Stop Tor
  4. Important Tor Ports
  5. Checking if Tor works

1. Installing Homebrew

Homebrew is probably the most popular package manager on macOS.

You can check if you have it, using this command:

brew --version

In the case you don’t have it, it can be easily downloaded here.

2. Installing Tor

If you want to you can install it from the Tor website. For the sake of this guide, we are doing it with brew, as it is faster.

brew install tor

You can check if it installed via the list command:

brew services list

3. Start/Stop Tor

This one is fairly easy to remember.

You can start and stop tor and list the services to check if it’s running.

brew services start tor
brew services stop tor
brew services list

4. Important Tor Ports

Port: 9050 — Proxy Port

  • is the default Port on which the Tor Network is running

Port: 9051 — Control Port

  • is used to set custom instructions/settings for the Tor Network
  • needs to be enabled in the .torrc file (settings)

Port: 9150 — Tor-Browser Port

  • is the Port on which the Tor-Browser is running
  • is separate to the Tor Network

5. Checking if Tor works

There are different ways to do this. Since I use Tor mostly as proxy for scraping, it’s only logical to test the Tor proxy.

We can check if the proxy works by making a request to a website which returns our IP address. I use https://httpbin.org/ip.

So let’s make a normal request.

It should return the IP like in the example above.

curl http://httpbin.org/ip
{
"origin": "185.220.101.50"
}

Now let’s make a request through the Tor proxy.

curl --socks5-hostname localhost:9050 http://httpbin.org/ip
{
"origin": "103.251.167.20"
}

If the IP is a different one. That means that Tor is working.

Congrats!

You can now use Tor to access and scrape anonymously.

--

--