How to block specific websites without using Parental Controls?

Actually you can do this but an intelligent and curious child might find what you have done and bypass your options. That said you could just edit the hosts file:

  1. Open a terminal window and type the following

cd /private/etc/

  1. This puts you into the Unix underpinnings of the macOS system. Once there we will use the "Nano" text editor to modify the hosts file, like this

sudo nano hosts

You will be prompted for a password. Use your account password there. If your system's hosts file has not been previously modified the Terminal window will change to look similar to this

Terminal running the Nano text editor

Now what you will need to do is enter the info on the websites you want to block. Remember that you only need block the root domain. So if he goes to a website like teenchat.co.jp/violentvideogames/killerclowns. You only need the part up to the first shash like this: teenchat.co.jp

  1. In the Terminal window type 127.0.0.1 teenchat.co.jp

127.0.0.1 refers to "localhost" or the computer you are currently on which does not have a web server on it followed by a space and the host name/URL of the web site you want to block

  1. Continue adding entries just like this, 127.0.0.1, a space then the host name/URL of the site you want to block. Each one on a new line.
  2. When you have entered all the sites you want to block hold ControlO and it will prompt for the fie to write out, just hit Return then ControlX to exit.

The words at the bottom indicate those commands and others with the Carat ^ symbol indicating the Control key.

  1. Once Nano has saved your hosts file and exited, reboot your Mac. Those sites should now give you errors when you go to them.

If your child has an admin password he can easily undo this as the password you enter when you type any command starting with "sudo" will be the password of the current user. If that user is not an admin it won't work.


To add to @Steve Chambers answer, it's important to know that this will only catch the explicitly listed site. In other words if you list facebook.com this will not block www.facebook.com or ww1.facebook.com. You must list each subdomain you want to block individually. Unfortunately, the hosts file doesn't support wildcards, so entries like *.facebook.com won't work. Also, you can chain entries on one row, so this is allowable:

127.0.0.1 www.facebook.com ww1.facebook.com www.facebook.net

The only way I can think of to do this (without enabling parental controls or using a 3rd party app) would be to edit the hosts file. See here for more info.