Block websites on your Mac Block websites on your Mac

The Internet provides access to a lot of useful information, but it can also be very distracting when you want to get something done. Especially nowadays, when almost every website embeds links to Facebook, YouTube, Twitter or other similar services, staying on track is quite difficult. Furthermore, getting kids to stay focused on their homework is even tougher. Fortunately, you can easily block any website that you want. Here's how to do that on a Mac:

In-built solution

If you're not the kind who likes to install third-party application, there's no need to worry; you can block as many websites as you want to without using a specialized tool and it's not that difficult. However, I recommend paying extra attention to what you're doing because if you press the wrong things you may end up blocking sites that you really need, all cutting out Internet access altogether. Just to be sure, lunch the Finder, then choose Go-->Go to Folder , type the following address: /private/etc/hosts and press Enter. Look for a file named Hosts and copy it to a different location so that you always have a backup.

Hosts fileHosts file

Now that that's out of the way, go to the Main Applications folder, select Utilities and open the Terminal. In the Terminal window type this command: sudo nano /etc/hosts and press Enter. You will be asked for your password, so type it in (the cursor won't move while you type) and press Enter. This will open up your hosts file and display a few things in the window. Now, you can actually start blocking off websites: go below the last written line and type 127.0.0.1, pres space then write the website that you want to block (without using http:// in front). For example, if I wanted to block off YouTube, I would type this "127.0.0.1 www.youtube.com". Enter all the addresses that you want to block one under the other, then long press Control + O to save and Control + X to close the window. Finally, type this in the terminal: sudo dscacheutil -flushcache and press Enter; it will clean your cache. Now, all those pesky websites will no longer be accessible on your Mac. To regain access repeat the process and delete the name of the website you want to visit from the hosts file.

Third-party solution

SelfControlSelfControl

If the DIY solution seems like a bit too much trouble, you can always use a specialized tool to help you out and SelfControl is the best solution that I know. Simply download and install the application, then launch it and click the Edit Blacklist button. Now add the websites that are distracting for you, select for how long those sites should be inaccessible and click Start. Just so you know, this tool actually means business and you really won't be able to visit any blocked websites until the timer reaches 0.            

Depending on your needs there are some more advanced solutions such as setting up parental controls or blocking websites at a router level so that no device in your home could reach them, but we will talk about them some other time.

Referenced applications

Cold Turkey
FREE

Android

rating

Cold Turkey
FREE

Windows

rating

Block digital distractions so that you can be more productive.

SelfControl
FREE

Mac

rating

Block your access to various websites and mail servers.

Author's other posts

Samsung's next Galaxy phone is already up for reservations
News
Samsung's next Galaxy phone is already up for reservations
Even though Samsung hasn't announced the price of the upcoming Galaxy phone or its technical specifications, we can already make reservations and be among the first to receive it.
Find out which Android phones will be able to run Fortnite
News
Find out which Android phones will be able to run Fortnite
Curious to see if you'll be able to play the Android version of Fortnite on your phone? Here's the complete list of supported devices.
Mac security tricks
Article
Mac security tricks
If you don't have a lot of experience in using your Mac, here are a few tips that could keep your machine safe from various threats.
Facebook is trying out paid subscriptions for Groups
News
Facebook is trying out paid subscriptions for Groups
Facebook may have found a new way to monetize its Groups feature as it's getting ready to start testing paid subscriptions.