In this article, we explain how to block websites on your Mac. Blocking certain websites can keep you productive during the workday, or minimize the chance of your child finding adult content. You can create a website “blacklist” for your Mac in several ways. While the built-in Parental Control options are the easiest to use, you will need to use the hosts file instead if you want to block sites on an administrator account. The best way to block websites on a Mac is to set up an account with parental controls that allow for customized content filtering or blocking.
- Click the Apple logo at the top left corner of the screen and select “System Preferences” from the dropdown menu.
- In the window that pops up, hit the “Parental Controls” icon (it’s a yellow circle with two stick figures inside it, in the bottom row).
- Enter the computer’s password for access (note that you may need to hit the padlock icon in the bottom left corner of the screen).
- Create a new account, enter a name and select the age of the user (go for 17+ if this is for a workplace or college).
- Click the word “Web” from the taskbar at the top of the Parental Controls window.
- To allow access only to specified sites, click the “Allow access to only these websites” option and enter the sites that will be permitted one by one; to block specific websites, click the “Try to limit access to adult websites” option, then hit the “Customize” button.
OXqk9ktTURBXy9iZDI2MjlhNC1iNTg0LTQyNzAtYWFmYS03YWE2MmJkYzM3N2UucG5nkpUCzQMUAMLDlQIAzQL4wsOBoTAF.jpg - In the popup window, enter the names of sites that are always to be blocked, then hit “OK.”
Now just make sure your kid, students, or employees can only log into the account you just configured to limit access, or all that work was for nothing.
And remember that these settings will only apply to Apple’s own browser, Safari. If you want to block websites in Chrome, Firefox, or other browsers, you’ll need to download specific add-ons for those browsers.
- Open the Terminal application. Open Applications, then Utilities, then Terminal. This application allows you to modify your hosts file, which provides IP addresses for certain URLs. By associating a false IP address with a certain URL, you can prevent your browsers from reaching it.
How To Block Websites On Your Mac - Back up your hosts file. If you make a mistake while editing the hosts file, you could block all access to the internet. Creating a backup copy allows you to return to the original version if this happens. This is as simple as a single command. In Terminal, type the following command exactly as it appears.
- Press Enter on your keyboard to execute the command.
- Enter an administrator password. Terminal should prompt you for your password. Type it in and press Enter.
W37sw9862nMWtMJwZZjB5Y-970-80.png - Open the hosts file. Enter the following command, then press Enter.
This command will open your Mac’s hosts file in TextEdit mode within Terminal. Alternatively, you can edit the hosts file in the main Terminal window using the command:
How To Block Websites On Your Mac - Skip past the existing text. Your hosts file should already have several IP addresses linked to “localhosts.” Never edit or delete this text, or your web browsers may stop working. Place your cursor on a new line at the bottom of the document.
If you are using the main Terminal window, use the arrow keys to reach the bottom of the page.
A few users have reported a bug where adding new text to the hosts file only works if you add them above the existing text.
- Type in “127.0.0.1 ” followed by that address with the “www.” prefix in front of it. Do not include “http://.” For example, “127.0.0.1 www.facebook.com”
How To Block Websites On Your Mac If a web browser is directed to this address, it will fail to reach the web page.
CjkMbUTuiwjLoMoLX7T7eQ-970-80.png The hosts file only checks for the exact URL you enter. For example, “google.com” will only block the Google home page. You will still be able to access google.com/maps, google.com/mail, and so on.
Tip:Do not copy-paste from another document. This can introduce invisible characters that prevent the text from working.
- Add more URLs on new lines. Press Enter and begin a new line with 127.0.0.1. Follow it with another URL you want to block. You may block any number of websites, but you must start each new line with 127.0.0.1.
Editor’s picks: