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 with the built-in Screen Time options, in Terminal, using third-party browser extensions or apps, or even on your router. If you’re struggling to access certain websites, we’ll also teach you how to unblock them.
Easy Ways to Block or Unblock Websites on Mac
The easiest way to block websites on a Mac is with Screen Time, but you can also do it with third-party apps or even in Terminal. If you can't get to a website, check your Screen Time settings or try using a VPN or proxy to get around regional blocks.
Steps
Blocking and Unblocking in Screen Time
-
Click the Apple icon . It’s the Apple logo in the menu bar at the top of your screen. This displays a drop-down menu.
-
Click System Settings . It's in the drop-down menu that appears when you click the Apple icon.
- If you’re using a pre-Ventura version of macOS, this will be called System Preferences .
Advertisement -
Click Screen Time . It's an icon that resembles an hourglass. In Monterey or later, you’ll find this in the sidebar on the left side of the System Settings/Preferences menu. In earlier macOS versions, you’ll see it in the main System Preferences window.
- If you are using an older version of macOS (pre-Catalina), click Parental Controls instead. You may need to set up a new account with parental controls.
-
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 macOS version, click the lock icon in the lower left corner and enter your user password. Then click the user you want to restrict.
- Skip this step if you’re trying to restrict websites on your own account.
-
Click Content & Privacy . In Ventura and later, it’s in the main Screen Time window on the right. In older versions of macOS (Monterey and earlier), it's at the bottom of the sidebar menu to the left.
-
Toggle on Content & Privacy . In earlier macOS versions, click Turn On instead. 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 toggle switch or the Turn Off button to turn content restrictions off.
-
Select Store, Web, Siri & Game Center Content . In Sonoma and later, it’s the first item in the menu under the Content & Privacy header after you activate the toggle switch. In earlier versions of macOS, click Content Restrictions or the Content tab at the top of the window.
- On pre-Catalina versions of macOS, click the Web tab at the top of the Parental Controls menu.
-
Select Limit Adult Websites . Depending on your version of macOS, you will either find this option in a dropdown menu or in a series of radio buttons next to the Web Content or Access to Web Content header.
- Alternatively, you can select Allowed Websites Only . This will block all websites except for the ones you allow.
-
Click Customize . This option will appear once you’ve selected either Limit Adult Websites or Allowed Websites Only . 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. Enter the web address for the website you want to block next to "URL." Then click Done or OK , depending on your version of macOS.
- If you want to remove a website from the restricted website, click the website you want to remove and click the " - " button below the box.
-
Click Done . This saves your list of allowed and restricted websites. Any websites in the "Restricted" list will be blocked.
- In some versions of macOS, click OK instead.
-
Turn off Limit Adult Websites to unblock all websites. To remove your restrictions, select Unrestricted Access from the Access to Web Content menu and click Done . You can also:
- Add specific websites to the Allow box or remove them from the Restricted box to unblock them.
- Toggle off Content & Privacy in the main Content & Privacy menu of Screen Time to turn off all restrictions.
Blocking Sites with the Hosts File
-
Open the Terminal application. To do so, click the magnifying glass icon in the upper-right corner of your Mac’s screen. 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 Return .
-
Enter an administrator password. The Terminal should prompt you for your password. Type it in and press Return . You won’t see your cursor moving as you type in the password.
-
Open the hosts file. To do so, type sudo nano /etc/hosts and press Return . 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 .
- Enter your administrator password again if prompted to do so.
-
Move your cursor to 127.0.0.1 localhost and press ⏎ Return . This line will be close to the bottom of the Host Database text. Use your arrow keys to move your cursor to the end of the line and press Return to create a new line.
- Don’t edit any other text that comes before this line.
-
Type 127.0.0.1 and press Tab ↹ . On your new line, type out 127.0.0.1 . Hit tab to create a space.
-
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 127.0.0.1 www.facebook.com .
- 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 Return and begin a new line with 127.0.0.1 . Press tab and 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".
-
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 Control + O to save, then Control + X to close the file.
-
Flush your DNS cache. 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. The correct command for doing this depends on your version of macOS.
- If you’re using Sonoma, Ventura, or Monterey, type or paste in the command sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder , then press return or enter .
- For earlier versions of macOS, check out our guide to flushing your cache .
- You may restart your computer instead to get the same effect. In many cases, the sites will be blocked even without this step.
-
Troubleshoot. 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:
- 127.0.0.1 (URL) without the "www"
- 127.0.0.1 m.(URL) will usually block the mobile version of the site
- 127.0.0.1 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 Control + O , delete the "-original" in the name, and confirm the save.
- You can also add a #
before the line containing the website you want to unblock to indicate that the line should not be read. That way, you can always keep the line and delete the #
in case you want to easily block it again.
- For example, you would write #127.0.0.1 www.facebook.com to unblock Facebook.
Expert Q&A
-
QuestionHow do I block a website on Safari?Yaffet Meshesha is a Computer Specialist and the Founder of Techy, a full-service computer pickup, repair, and delivery service. With over eight years of experience, Yaffet specializes in computer repairs and technical support. Techy has been featured on TechCrunch and Time.Each browser will have it's own security and privacy settings where you can add sites you want to block or unblock.
-
QuestionHow do I use Parental Control without needing access to an Administrator account?Community AnswerThis can't be done. An Administrator account is required to change Parental Control settings.
-
QuestionIs there any way to do this without a password?Community AnswerNo. An Administrator account is required to change parental control settings.
Video
Tips
- If websites are blocked in your region or by your internet service provider, you may be able to get around the blocks by installing a VPN on your Mac.Thanks
References
- ↑ https://support.apple.com/en-sg/guide/safari/ibrw1071/16.0/mac/11.0
- ↑ https://support.apple.com/en-sg/guide/safari/ibrw1053/mac
- ↑ https://mjtsai.com/blog/2024/02/02/google-removes-cache-link-from-search-results/
- ↑ https://www-01.ibm.com/support/knowledgecenter/ssw_aix_71/com.ibm.aix.files/hosts.htm
- ↑ https://github.com/smdahlen/vagrant-hostmanager/issues/60
About This Article
1. Open System Preferences
.
2. Click the Screen Time
icon.
3. Click Content & Privacy
.
4. Click Turn on
in the upper-right corner.
5. Select Limit adult websites
.
6. Click Customize
.
7. Click +
below the "Restricted" box.
8. Enter the website you want to block and click Ok
.
9. Click Ok
.
Reader Success Stories
- "This was so so helpful! Thank you immensely, wikiHow, you guys are awesome. "