How to Block a Website in Any Browser on a Mac
The internet allows us to access the wealth of human knowledge with a single click. On the other hand, it also allows kids to access potentially harmful content. You can use website blockers to restrict harmful or time-wasting websites, like adult sites or social media.
However, there are easier methods to block websites on your Mac, especially using Screen Time. We’ll cover how to do this below, so keep on reading.
What Is Screen Time?
Screen Time is Apple’s method of helping users control their Mac or iPhone usage. It can be also be used to control and restrict specific websites, whether you’re restricting adult websites, addictive games, or YouTube channels.
You can also use Screen Time controls to limit social media use throughout your workday to help you focus on the task at hand instead.
How to Use Screen Time to Block a Website
No matter what your intended use is, blocking a website is very easy in Screen Time. This applies to all browsers you may use on your Mac: Safari, Google Chrome, Firefox, and so on.
To block a website on your Mac, just follow these steps:
- Open System Preferences and go to Screen Time.
- Select App Limits from the left-hand pane. Turn them on if they’re disabled.
- Click the plus (+) sign. You’ll see different categories here, which you can choose to limit access to.
- Scroll down to see all the websites you can block. You can even add your own websites to the list. To do this, click on the plus (+) sign next to Add website and enter the specific website address.
- Once you select the app or website you want to block, you can specify the exact daily time limit in the box below. You can also click on Custom > Edit to set a variable limit depending on the day.
Once you have all your restricted websites set up, make sure you set up a Screen Time password to ensure no one can change the settings you made without your permission. To do this, go to Options and choose to Use Screen Time Passcode.
Enable Share across devices to share these settings for all the devices signed in to your iCloud account.
You can choose to block all adult websites through Screen Time. To do this, click on Content & Privacy > Turn On. Select either Limit Adult Websites or Allowed Websites Only, depending on what your requirements are. You can switch to the Apps tab and uncheck any internet apps or browsers that you want to disable.
How to Use Terminal to Block a Website
If you are not a fan of the Screen Time method to control web access on your Mac, another method to block websites is by editing the Hosts file in Terminal. This may seem a bit more complicated than Screen Time since it involves the command line. However, it is very easy and straightforward once you get the hang of it.
An advantage of editing the Hosts file for blocking websites rather than using specific browser plugins or extensions is that this method remains valid across all browsers and does not depend on any third-party plugin. On the other hand, extensions can sometimes stop working or may become outdated over time.
The advantage of Terminal over Screen Time is that it would be harder for a child to undo these changes if they gained access to your Screen Time passcode.
To create a block list using a Hosts file, follow the steps below:
- Open up Terminal on your Mac. You can do this by searching for Terminal in Spotlight, or by navigating to Finder > Applications > Utilities > Terminal.
- We’ll be backing up the hosts file first. This will allow us to restore the original file in case something goes wrong. To do this, enter the following line of code into Terminal, and press Return on your keyboard:
sudo /bin/cp /etc/hosts /etc/hosts-original
- Type in your administrator password and press the Return key. Note that the cursor will not move from its position as you type your password.
- Once done, type in the command below and press Return on your keyboard. This will open the hosts file.
sudo nano -e /etc/hosts
- Use the arrow keys to go to the bottom of the line. Type 127.0.0.1 and the website address you want to block. For example, to block YouTube, I would enter the following in Terminal:
- Type each website on a separate line. Once you’re done, press Control + O followed by Return on your keyboard to save the file, and then Control + X to close the file.
- Type the following command to flush the cache, which will enforce these changes across the browsers. Press Return to enter the command:
sudo dscacheutil -flushcach
- Now, when you open a blocked website in any browser, you’ll get a message that says you’re unable to connect.
Blocking Websites in a Specific Browser
There may be some specific cases where you want to block access to certain websites on a specific browser only. For example, you may only use Google Chrome for your work-related stuff, which is why you might want to block social media websites on Chrome only. In such cases, the Screen Time or Terminal method won’t work, as it blocks website access for all browsers. An alternate to this is choosing to block specific websites directly through the browser instead.
Since every browser is different, the method for blocking websites through the browser can be different. Safari blocks websites using Screen Time, whereas you can use blocking extensions, such as Block Site and StayFocusd, to block websites on Google Chrome.
Screen Time vs. Browser-Based Blocking
While you can block websites specifically in any browser, it makes more sense to block sites using Screen Time. Screen Time applies uniformly to all your browsers (even if someone installs a new browser to circumvent your measures), and can also be synced across devices. Terminal is also another good measure to keep specific websites blocked on your browsers.
Using browser-specific plugins to block websites may fall prone to hacks and outdated software. That’s why we recommend using Screen Time or Terminal for blocking websites on your Mac.
If you don’t want to use Apple’s Family Sharing anymore, you can remove yourself from the group or disband it altogether.
About The Author