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:
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.
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.
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.