How to Block and Unblock Websites on Mac

Blocking a website can make you more productive, or limit children's access to unhealthy content. You can create a 'blacklist' of websites on Mac in several ways. Although the built-in Parental Control option is the easiest to use, you will need to edit the hosts file if you want to block websites on an administrator account.

Enable Parental Controls

How to Block and Unblock Websites on Mac Picture 1How to Block and Unblock Websites on Mac Picture 1

Open System Preferences. Click the apple icon in the menu at the top of the screen and select System Preferences. You can find it in the Applications folder or on the Dock (System Tray).

How to Block and Unblock Websites on Mac Picture 2How to Block and Unblock Websites on Mac Picture 2

Select Parental Controls. On most versions of OS X, this option has a yellow icon. If you don't see the icon, you can type "Parental Controls" into the search bar in the top right corner of the System Preferences window. The corresponding icon will be highlighted.

How to Block and Unblock Websites on Mac Picture 3How to Block and Unblock Websites on Mac Picture 3

Select the child's account. In the left panel, click on the user account you want to block or unblock the website, then click "Enable Parental Controls". You cannot activate with an administrator account.

If your child doesn't have an account, select "create a new account with parental controls" and follow the on-screen instructions.

If you cannot select a user, click on the lock icon in the corner of the screen and enter the administrator password.

How to Block and Unblock Websites on Mac Picture 4How to Block and Unblock Websites on Mac Picture 4

Open the Web tab. This tab is at the top of the window. Some older versions of Mac OS X will replace it with a "Content" tab.

How to Block and Unblock Websites on Mac Picture 5How to Block and Unblock Websites on Mac Picture 5

Access options to block websites. There are 2 ways to manage children's internet access:

Selecting "Try to limit access to adult websites automatically" will block adult websites from Apple's default list. You can add or remove websites from this list using the Customize button.

"Allow access to only these websites" will block all websites except the websites in the list. Add or remove websites using the + and - buttons.

How to Block and Unblock Websites on Mac Picture 6How to Block and Unblock Websites on Mac Picture 6

See additional restrictions. To block access to adult content on the app, click on the App tab and adjust the settings as desired. To limit access on your computer during certain times, access the Time Limits tab.

How to Block and Unblock Websites on Mac Picture 7How to Block and Unblock Websites on Mac Picture 7

Block websites. To unblock all websites, select "Allow unrestricted access to websites". This option does not disable parental control settings on other tabs (e.g. Apps and People).

Block websites with hosts file

How to Block and Unblock Websites on Mac Picture 8How to Block and Unblock Websites on Mac Picture 8

Open the Terminal application. Open Applications > Utilities > Terminal. The application allows you to edit the hosts file - providing the IP address of the specific URL. By combining the fake IP address of a specific URL, you can prevent browsers from accessing that website.

This method is not 100% guaranteed and is not too difficult to overcome. But this is a quick way to set up a website on your personal computer so it doesn't affect your productivity. Although this is not the only way to block user access, you can combine it with other methods to achieve greater efficiency.

How to Block and Unblock Websites on Mac Picture 9How to Block and Unblock Websites on Mac Picture 9

Backup hosts file. If a mistake is made when editing the hosts file, all internet access may be blocked. Creating a copy of the hosts file allows you to reuse the original if this is the case. With just one simple command:

In Terminal, enter the command sudo /bin/cp /etc/hosts /etc/hosts-originalexactly as it appears.

Press the Enter button on the keyboard to execute the command.

How to Block and Unblock Websites on Mac Picture 10How to Block and Unblock Websites on Mac Picture 10

Enter the administrator password. Terminal will ask you to enter your password. Type the password and press Enter. The mouse pointer will not change position when you enter a password.

How to Block and Unblock Websites on Mac Picture 11How to Block and Unblock Websites on Mac Picture 11

Open the hosts file. Enter the command below and press Enter: sudo /Applications/TextEdit.app/Contents/MacOS/TextEdit /etc/hosts. This command will open your Mac's hosts file in TextEdit mode in Terminal.

Additionally, you can edit the hosts file in the Terminal window with the command sudo nano -e /etc/hosts.

How to Block and Unblock Websites on Mac Picture 12How to Block and Unblock Websites on Mac Picture 12

Skip existing text. The hosts file already has several IP addresses associated with "localhosts". Do not edit or delete this text or the browser will not function. Hover over the new line at the end of the text.

If you use the main Terminal window, use the arrow keys to move to the last line of the page.

Some users have reported an error where you can only add a new line above existing text in the hosts file.

How to Block and Unblock Websites on Mac Picture 13How to Block and Unblock Websites on Mac Picture 13

Type 127 .0.0.1 . This is the internal IP address. If the web browser goes directly to this address, it cannot access the website.

How to Block and Unblock Websites on Mac Picture 14How to Block and Unblock Websites on Mac Picture 14

Press the spacebar, then type the URL you want to block. Do not type "http://." For example, if you want to block access to Facebook, enter "127.0.0.1 www.facebook.com."

The hosts file only checks that the URL you enter is correct . For example, "google.com" only blocks the Google home page. You can still visit google.com/maps, google.com/mail, etc

Do not copy-paste from another document as there may exist some invisible characters that prevent the text from working.

How to Block and Unblock Websites on Mac Picture 15How to Block and Unblock Websites on Mac Picture 15

Add the URL in a new line. Press Enter and start a new line with 127.0.0.1. Add it after the URL you want to block. You can block any website, but you must write a new line with 127.0.0.1.

In theory, you can add multiple URLs to one line (enter the IP address once), up to 255 characters. However, this method does not work on all versions of Mac OS X.

How to Block and Unblock Websites on Mac Picture 16How to Block and Unblock Websites on Mac Picture 16

Turn off and save the hosts file. Close or exit the TextEdit dialog box when finished, then confirm you want to save the TextEdit file when asked. (In some cases, the file will be saved automatically.)

If editing in the main Terminal window, press ctrl+O to save, then press ctrl+X to close the file.

How to Block and Unblock Websites on Mac Picture 17How to Block and Unblock Websites on Mac Picture 17

Clear cache. Type the command dscacheutil -flushcacheinto Terminal and press Enter. This command clears the cache so the web browser will check for updates to the hosts file immediately. The listed website will be blocked on all browsers.

You can restart your computer instead of clearing the cache. In many cases, the website will be blocked without needing to perform these operations.

How to Block and Unblock Websites on Mac Picture 18How to Block and Unblock Websites on Mac Picture 18

Fix problem. If you can still access the website, it is likely that your web browser is accessing another subdomain, or accessing via IPv6 or bypassing this website's hosts file. You can fix the first two problems by adding the following lines to the hosts file:

127.0.0.1 (URL) without "www"

127.0.0.1 m.(URL) will block the mobile version of that website.

127.0.0.1 login.(URL) or apps.(URL) are some common variations of the home page. Visit the website and check the address for accuracy.

fe80::1%lo0 (URL) blocks access to the web over IPv6. Most websites do not automatically connect via IPv6, but Facebook is an exception.

If the above methods do not work, perhaps the hosts file is not working. Try another method of blocking websites.

How to Block and Unblock Websites on Mac Picture 19How to Block and Unblock Websites on Mac Picture 19

Delete text to unblock websites. Open the hosts file and delete the line containing the URL you want to unblock. Save, exit, and clear cache according to the instructions in the step above to apply the changes.

To undo changes and restore from backup, press the key sudo nano /etc/hosts-originalin Terminal. Press ctrl+O, delete "-original" in the name, confirm and save.

Use another method

How to Block and Unblock Websites on Mac Picture 20How to Block and Unblock Websites on Mac Picture 20

Install web browser extensions. Chrome, Firefox, and most modern browsers allow you to install extensions (or "add-ons") to adjust your browser's settings. Search for "block websites" or "filter websites" or "productivity" in your browser's utility store to find website blocking applications. Install the application, restart the browser then open the application settings, add the website you want to block.

Be cautious with apps that have low ratings or few reviews. Untrusted utilities can install malware on your computer.

This method only blocks websites on installed browsers.

How to Block and Unblock Websites on Mac Picture 21How to Block and Unblock Websites on Mac Picture 21

Adjust router settings . Blocking a website from your router will prevent devices using the wireless network from accessing that website. Here's how to install:

Go to System Preferences → Network → WiFi → Advanced → TCP/IP tab.

Copy the IP address listed under "Router" and paste it into your browser's address bar. You will be taken to the router's settings page.

Enter username and password to log in to the router. If you've never changed the settings, find the default password for your router by product line. (Usually the username is "admin" and the password is "password")

Go to your router settings and find the option to block websites. Each manufacturer has a different way of arranging the menu, but you can find it in the "Access" or "Content" categories.

5 ★ | 2 Vote