how to block websites on Mac terminal

Distraction in the mid of any task is really annoying and moreover, it negatively affects the production. Social networking websites such as Facebook, Twitter, Instagram are some of the very addicted websites these days without which we can hardly live. It has become a habit to check either Facebook or Twitter in every half an hour. And the bad thing is it is actually affecting your work So; the best suggestion is to block those websites on your PC for a better result. In case you are using a MacBook Pro and wondering that how to block websites on Mac terminal, you are at the right page. We have discussed that part in this article in more details.

How to block websites on Mac terminal

how to block websites on Mac terminal

There are actually few ways to block a website on your Mac. But, the use of Mac terminal for this is the simplest method which takes hardly any time. So, this is considered as the best method and we have discussed here this method to block a website on your Mac.

First, go to Application > Utilities and select Terminal app on your MacBook.

In the terminal, you need to type then ‘sudo nano /etc/hosts’ in the command line.

Next, you might be asked for the admin password. Provide the password if you asked to do so.

Press enter and it will open the host file for the Mac.

Go to the bottom using the down arrow and find the part that says ‘127.0.0.1 localhost’.

Here you need to type ‘127.0.0.1 facebook.com’.

Create a new line where you can type ‘0.0.1 www.facebook.com’. This is just for extra measure. You can add even more website in the list just by pressing enter and adding a new line.

Now press ctrl+O to save the changes in the database and exit from there by pressing ctrl+X.

The next and most important task is to flush the existing cache by typing ‘sudo dscacheutil -flushcache’ in the terminal command line.

That’s it. Next time whenever you will try to open facebook.com, it will show that unable to connect error message.

Now, if you want to unblock the blocked website and looking for ways on how to unblock websites on Mac Terminal, just delete the added websites and flush the DNS cache as well.

Experiencing difficulties with your Device, check out our “How To” page on how to resolve some of these issues.

LEAVE A REPLY

Please enter your comment!
Please enter your name here