How to block websites on Mac

Complete guide with multiple methods and troubleshooting.

7-10 min read
Expert Verified
Last Updated: August 2025

Quick Answer

Blocking websites on a Mac can be accomplished through various methods, including using built-in parental controls, modifying the hosts file, or utilizing third-party applications. Each method has its own advantages and is suitable for different user needs.

Medium7-10 min read

Prerequisites & Requirements

Before you start blocking websites on your Mac, ensure you meet the following requirements:
  • A Mac running macOS Mojave (10.14) or later.
  • Administrator access to the Mac to modify system settings.
  • Basic understanding of navigating system preferences and file directories.
  • Backup important data before making changes to system files.

Method 1: Using Parental Controls

This method is ideal for parents wanting to restrict access to certain websites for their children. It allows for easy management through System Preferences.
  • Step 1: Open System Preferences by clicking the Apple menu () in the top-left corner and selecting 'System Preferences'.
  • Step 2: Click on 'Screen Time'. If you don't see this option, ensure your macOS is updated to at least Mojave (10.14).
  • Step 3: Click on 'Content & Privacy' in the left sidebar and enable it by clicking the toggle switch.
  • Step 4: Click on the 'Web Content' tab and select 'Limit Adult Websites'.
  • Step 5: Under 'Never Allow', click the '+' button to add specific websites you want to block.
  • Step 6: To verify, attempt to access the blocked website in Safari. You should see a message indicating the site is restricted.
  • Step 7: If it doesn't work, ensure that Screen Time is enabled and that you have added the correct website URLs.

For macOS Ventura (13) and later

In macOS Ventura and later, the Screen Time interface has been updated for better usability.
  • Step 1: Open System Settings instead of System Preferences.
  • Step 2: Navigate to 'Screen Time' and follow the same steps as outlined above.

For macOS Monterey (12) and earlier

The steps remain largely the same, but the layout may differ slightly.
  • Step 1: Open System Preferences and select 'Parental Controls' instead of 'Screen Time'.
  • Step 2: Select the user account you want to manage and check 'Web' to limit access.

Method 2: Modifying the Hosts File

This method is more technical and is suitable for users who want a more permanent solution to block websites across all browsers.
  • Step 1: Open Terminal by searching for it in Spotlight (Cmd + Space) and typing 'Terminal'.
  • Step 2: Type 'sudo nano /etc/hosts' and press Enter. You will need to enter your administrator password.
  • Step 3: Use the arrow keys to navigate to the bottom of the file and add a new line for each website you want to block, formatted as follows: '127.0.0.1 www.example.com'.
  • Step 4: Press Ctrl + O to save the changes and then Ctrl + X to exit the editor.
  • Step 5: Flush the DNS cache by typing 'sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder' and pressing Enter.
  • Step 6: To verify, try accessing the blocked website in any browser. It should redirect to a 'This site can’t be reached' message.
  • Step 7: If it doesn't work, ensure you have saved the hosts file correctly and that you flushed the DNS cache.

Troubleshooting Common Issues

If you encounter issues while blocking websites, consider the following solutions:
  • Error: 'Website not blocked' - Solution: Ensure you have entered the correct URL in the blocking method used.
  • Issue: 'Changes not saved' - Fix: Make sure you have administrative privileges and that you are saving files correctly.
  • Problem: 'Accessing blocked site through VPN' - Workaround: Disable the VPN or configure it to respect local DNS settings.

Advanced Tips & Shortcuts

For power users looking to enhance their website blocking capabilities:
  • Keyboard shortcut: Cmd + Space - Opens Spotlight for quick access to applications.
  • Command line: 'sudo nano /etc/hosts' - Directly edit the hosts file for website blocking.
  • Hidden feature: Use 'Screen Time' to set time limits for specific apps or websites, enhancing productivity.

Common Mistakes to Avoid

Avoid these common pitfalls:

Expert Tips

Using a combination of methods can provide a more robust solution for blocking websites.