How to Block and Unblock Websites on a Mac

Do you want to block or unblock websites on a 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.  You can also block websites using third-party web browser extensions, apps, or block websites on your router.  This minHour article teaches you how to block and unblock internet websites on a Mac.

Enabling Parental Controls

Click the Apple icon.

It’s the icon that resembles the Apple logo in the upper-right corner. It’s in the menu bar at the top. This displays a drop-down menu.

Click System Preferences.

It’s in the drop-down menu that appears when you click the Apple icon.

Click Screen Time.

It’s an icon that resembles an hourglass. Click this icon on the System Preferences menu.

  • If you are using an older version of macOS, click Parental Controls instead.

Select a family member (if you have Family Sharing active).

If you are a member of a family-sharing group, you can click the pop-up menu in the sidebar to the left and select the family member you want to restrict from accessing certain websites.

  • If you have an older version of macOS, click the lock icon in the lower-left corner and enter your user password. Then click the user you want to restrict.

Click Content & Privacy.

It’s at the bottom of the sidebar menu to the left.

Click Turn On.

It’s in the upper-right corner. This enables Content and Privacy restrictions.

  • If you want to disable all web and content restrictions, click the button again to turn content restrictions off.

Select the Content tab.

It’s the first tab at the top.

  • On older versions of macOS, click the Web tab at the top of the Parental Controls menu.

Select “Limit adult websites.”

It’s the second option next to “Web content.” This attempts to block adult websites while surfing the internet.

  • Alternatively, you can select “Allowed websites only.” This will block all websites except for the ones you allow.

Click Customize.

It’s below all options next to “Web.” This allows you to customize what sites you want to allow and restrict.

Click +.below the “Restricted” box.

It’s the box at the bottom. This is where you can enter specific websites you want to block.

  • Alternatively, if you block all but allowed websites, you can enter the websites you want to allow by clicking the “+” button below the “Allow” box.

Enter the URL for the website you want to block and click Ok.

Enter the web address for the website you want to block next to “URL.” Then click .

  • If you want to remove a website from the restricted website, click the website you want to remove and click the “-” button at below the box.

Click Ok.

This saves your list of allowed and restricted websites. Any websites in the “Restricted” list will be blocked.

Using Apps, Extensions, & Router Settings

Install a browser extension.

Most web browsers have extensions that you can install, which allow you to block specific websites. You can install extensions that block websites on Google Chrome, Safari, and Firefox. Access the store for that web browser and search for site blocker extensions.

  • You can access the Google Chrome store at You can access the Firefox extension store by typing “about:addons” in the address bar. You can download extensions for Safari in the App Store.
  • Some extensions you can use to block websites include; “BlockSite,” “Stay Focused,” “Simple Blocker,” and more.
  • Be careful of apps with low ratings, or too few reviews to judge accurately. Untrustworthy extensions may install malware to your computer.
  • This will only block websites on the browser the extension is installed on.

Install content-blocking apps.

In addition to web browser extensions, you can also download apps that block content on your computer. There are plenty of apps that block websites for both parental control purposes, as well as productivity purposes. These apps include; Net Nanny, Freedom, Cold Turkey Blocker, SelfControl, Focus, and more.

Adjust your router settings.

Blocking sites on your router will prevent any device using the wireless network from accessing those sites. To access your router, you will need to find your IP address and enter it in your web browser. Use the following steps to adjust your router settings:

  • Go to System Preferences → Network → Wi-Fi → Advanced, and click the TCP/IP tab.
  • Copy the IP address listed after “Router” or “IPv4” and paste it into your browser’s address bar. This should take you to your router settings.
  • Enter the username and password to log in to your router. If you have never set these, look up the default password for that router model. (User “admin” and password “password” are common defaults.)
  • Browse the router settings for site-blocking options. Each router brand has a different set of options, but most allow you to block sites in an area labeled, “Access,” “Content,” “Rules,” “Blocked Domains,” or something similar.
  • Add any websites you want to block. There will most likely be an option to click to add websites. Click this option and then add the website URL you want to block.

Blocking Sites with the Hosts File

Open the Terminal application.

To do so, click the magnifying glass icon in the upper-right corner. Type “Terminal” in the search bar. Then click the Terminal app in the search results.

  • This method does not have a 100% success rate, and is not too difficult to bypass. It’s a quick way to block a website on your personal computer, for productivity reasons. While not recommended as the only way to block other users’ access, you can try it alongside another method for greater effect.

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:

  • To back up the host file, type sudo /bin/cp /etc/hosts /etc/hosts-original in the Terminal exactly as it appears. Then press Enter.

Enter an administrator password.

The Terminal should prompt you for your password. Type it in and press . The cursor will not move from its position as you type your password.

Open the hosts file.

To do so, type sudo /Applications/ /etc/hosts and press . This command will open your Mac’s hosts file in TextEdit.

  • Alternatively, you can edit the hosts file in the main Terminal window using the command sudo nano -e /etc/hosts.

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 below all the other text.

This is the local IP address. If a web browser is directed to this address, it will fail to reach the web page.

Hit the space bar, then type the URL you would like to block.

Do not include “http://.” For example, if you want to block access to Facebook, the line should read

  • The hosts file only checks for the exact URL you enter. For example, “” will only block the Google home page. You will still be able to access,, and so on.
  • Do not copy-paste from another document. This can introduce invisible characters that prevent the text from working.

Add more URLs you want to block on new lines.

To do so, press and begin a new line with Follow it with another URL you want to block. You may block any number of websites, but you must start each new line with “”.

  • In theory you can include multiple URLs on one line (entering the IP address only once), up to a maximum of 255 characters. However, this may not work on all versions of Mac OS X.

Close and save the hosts file.

Close or quit the TextEdit dialog box when you are done, then confirm that you want to save the TextEdit file when prompted. (In some cases the file may save automatically.)

  • If editing in the main Terminal window, press to save, then to close the file.

Type the command dscacheutil -flushcache into Terminal and press [{keypress|Enter}}.

This will clear the cache so your browser is sure to check the updated hosts file immediately. The websites you listed should now be blocked on all browsers.

  • You may restart your computer instead to get the same effect. In many cases, the sites will be blocked even without this step.


If you can still access one of the websites, your browser may be accessing a different subdomain, accessing the site via IPv6, or bypassing your hosts file for that site. You can solve the first two problems by adding more lines to your hosts file:

  • (URL) without the “www”
  • m.(URL) will usually block the mobile version of the site
  • login.(URL) or apps.(URL) are a couple common variations of home pages. Visit the website and check your address bar for the exact variation.
  • Entering “fe80::1%lo0 (URL)” blocks IPv6 access to the site. Most sites do not automatically connect you via IPv6, but Facebook is a notable exception.
  • If none of these variations work, there is probably no hosts file workaround. Try one of the other block methods on this page.

Remove the entry to unblock the website.

Open your hosts file again and delete the entry for the URL you would like to unblock. Save, quit, and flush the cache as described above to push through the change.

  • To undo all changes and restore from your backup, enter sudo nano /etc/hosts-original in Terminal. Press , delete the “-original” in the name, and confirm the save.


  • Did you know wikiHow offers a variety of coupons for VPN services? This can increase your security and safety online. Check out our coupon site for tons of money-saving deals and promo codes.

Leave a Comment