Block access to websites on a Mac using hosts file

by

Hosts

 

In this tutorial I will show you how to block access to specific website without using any external application.

 

For example :

 

Lets say we want to block outgoing connections for adobe application and we have the following sites that we want to block

 

activate.adobe.com
practivate.adobe.com
lm.licenses.adobe.com
lmlicenses.wip4.adobe.com

 

So these method is the best way to block these sites.

 

How to do that ???

 

1- Open up your Terminal and type the following (You’ll be asked for your root password because this is a system file):

 

sudo nano /etc/hosts

 

2- This will bring up a screen that looks a lot like the one below, notice that “activate.adobe.com” has been added at the bottom as a site we want to block. To block any other site, simply type it in the same fashion. You can have as many sites map to 127.0.0.1 as you want:

 

Terminal Feb 11 22.36.06

 

Now save the file in nano by hitting control + o and the return key.

 

Note that you may need to run the following command for changes to take effect:

 

sudo dscacheutil -flushcache