Anonymise yourself! How to set up tor in mac? In the terminal - noob_sec series
Tags: security, tor, codenewbie, programming
Published: 2021-07-18 17:40:19

---
series: noob_sec
---

Hey all! Let me ask you a question. If I said to you I have a proxy server and if you pass your traffic through my servers I will keep your browser data encrypted and hide your IP and I will keep a record of your traffic. That is in layman's terms, I won't let anyone know what are you doing on the internet, only I will know. Would you trust me and accept my offer? 

Or If my friend, lets call him John has another service. A decentralised peer to peer network where no such organisation/company keeps logs of your traffic and pretty much does the same thing. Helps you hide your IP and stuff. 

Which service would you choose? mine or Johns? Let me guess, John's right? See! I'm already in your brain! But there's a caveat to John's service. They are a bit slow and the setup process is a bit of an hassle. That's why people still choose my service over John's. Because with my service, with 1 click you can be anywhere in the world, encrypt your browser history all that good stuff.

Well, maybe you have already figured out what are the two services I am talking about in the previous example. But if not, let me do the honours, They are VPNs(my service) and tor(John's service). Now, I am not encouraging or discouraging you to use one or the other services in question here. That's totally your choice. This article is just an introduction to `tor` and how you can get sneak peek of `tor`'s powers. Keep in mind this will not be a complete setup with proxychains and stuff, just how to install mac and pass your traffic through tor so your IP is hidden. You can follow this tutorial if you don't have a mac as well. You'll just have to know how to install stuff from your package registry and how to add a proxy in your system.

Generally you can install [`tor browser`](https://www.torproject.org/download/) and use that to get all the features of `tor`. But I want to pass all traffic of my system through `tor` and not only the requests that are made from the `tor browser`. For example, requests from the terminal as well.

## Installation
I will be using `Homebrew` to install tor. if you do not have `brew` installed. Download it from [here](https://brew.sh/) or run this command in your terminal.
```bash
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
```
Now that we have `brew`, we can go ahead and install tor.
Run this command to install tor.
```bash
brew install tor
```
After the command has finished running, we should have tor installed in our system. Lets start the tor service now.
Run this command to start tor.
```bash
brew services start tor
```
If it ran successfully you should see and output like this:
```bash
==> Successfully started `tor` (label: homebrew.mxcl.tor)
```

Now let's verify if tor proxy is running or not. It by default runs on `localhost:9050` so let's use netstat to verify that.
```bash
netstat -ant | grep 9050
```
If you see something similar to this, all good!
```bash
tcp4       0      0  127.0.0.1.9050         *.*        LISTEN
```

Now all we have to do is pass our traffic through this proxy. We'll see that in a moment but before that let's see what our IP address is right now. Google `what is my ip` or [click in this link to do the same](https://www.google.com/search?q=what+is+my+ip). Now lets pass our traffic through tor's proxy to see if our IP changes.

In your mac, open `system preferences`.
![System preferences](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7n69hja2c2tfu1ihwn43.png)

Then click on `Network`,
![Network](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t98dkk49gjw3ro6h8kwz.png)

Then click on advanced, (also do that `click on the lock and enter password` thing if you have to.
![advanced ?](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b0u6lpi0knt2v1w75s25.png)

Then click on the `proxies` tab,
![Proxies](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6rhm3ekwcp5aw205tra7.png)

Choose the `SOCKS proxy` from the check list and on the right side, enter localhost - `127.0.0.1` on the first input box and `9050` in the second which is for the port. Then click on `Ok` and then `Apply`. 
![SOCKS Proxy](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/84tcuz0gma9y4d4c44ph.png)

AND we are done! Now if you Google `what is my ip` or [click in this link to do the same](https://www.google.com/search?q=what+is+my+ip)! Did you see it? Because I did! That shows a different IP!

As I said in the beginning, `tor` is a bit slow for normal browsing, why? That might be a topic for another article but now the question is are you willing to use tor for normal browsing even if it's slow? No right? Yeah me too. But after watching that crazy youtube conspiracy video of governments spying on people, when your paranoia hits, you can just turn on tor! or maybe for other stuff. Don't use it for bad practices obviously, you'll be an idiot if you do so.

Let me get you started with this paranoia thing a little bit so you can use tor right away 😂. Sure VPNs hide your IP, encrypt your browser history and stuff. But they do have log of all your browsing data. Why do you think they keep that? Why do you think VPNs were invented on the first place? hmm........

See you on another article!