26 Dec How to Block Websites on Safari
Whether you want to prevent your children from accessing adult sites or looking to prevent everyone in your family from accessing unsafe data, it is best to block certain websites on your Mac. Using Apple’s parental controls (in the built-in Screen Time app) can be helpful, but they can also be blunt tools. You may want to block websites when you don’t have parental controls on Safari on your Mac. Our blog post will show you how to do both, so take the time to read every word carefully.
How to Block Websites on Safari Using Screen Time
The Screen Time feature was added to macOS recently. For using the Screen Time feature, you must upgrade your macOS version if you have an older version. There are two ways to update Mac OS manually, if you don’t know – check How to Update Mac OS – 2 Manual Ways.
Moreover, it also has the ability to block sites from opening, even if its primary purpose is to limit website activity. All browsers are supported by the solution. Although it was originally meant to block adult sites, who says you can’t modify it to block anything else?
- Go to System Preferences > Screen Time.
- Choose Content & Privacy.
- Then, select Limit adult websites > Customise.
- Next, select the site you want to block.
Now, you won’t be able to access that site as it is blocked by Safari.
How to Block Websites on Safari Using Terminal
You’ll need to use a different approach if you want to block certain websites in Safari, or any other browser on your Mac. In case you’re comfortable using Terminal, you can execute Unix commands.
The following method edits your Mac’s host file. Browsers use this file to find websites you wish to visit. The file could be altered in such a way that it causes major problems, including making the web completely unusable. Thus, it should only be used by people who are comfortable with the Terminal. In addition, you should make a backup of the host file. You can do that by following these steps.
- Navigate to Applications > Utilities and double-click Terminal and launch it.
- Type: sudo /bin/cp /etc/hosts /etc/hosts-original
- Press Return and type in the admin password when
The host file is now backed up, so if anything goes wrong, you can restore it and regain access to websites. Follow the steps below carefully to block specific websites in the host file. You should be aware that the only URL blocked is the one you type in. As an example, if you type instagram.com ‘www’ won’t be blocked. If you want to block both URLs, you must type them separately. Also, subdomains aren’t blocked, so mobile versions of sites (usually beginning with ‘m’) and login pages that have separate subdomains won’t be blocked. Those URLs will also need to be typed separately. And, to do so, follow these instructions:
- Type: Sudo nano/etc/hosts
- Ensure that the cursor entry point is on a new line underneath all the text on-screen. There must not be any changes made to the text already displayed
- Type: 0.0.1
- The local IP address cannot be accessed by any website, so we must direct those websites we wish to block to that address
- Once you’ve entered the IP address, hit Space and type the URL of the site you want to be blocked. Avoid pasting it as pasting can introduce hidden characters that could cause issues
- Click Return
- Type:0.0.1 again, then a space, then the next URL. Remember to type subdomains or directories separately if you want to block them.
- Press Return
- Once you’ve typed all the URLs you want to block, repeat steps 7 and 8
- Whenever you’re finished, press Control-O to save the host file and then Control-X to close it
- Type: dscacheutil -flushcache then click Return. It flushes the cache, so the web browser will have to refer to the hosts file
- By following the above steps, IPv4-based sites will be blocked in all browsers, but IPv6-based sites will be unblocked. In the event that a site is still accessible, it may be connected via IPv6.
Block Websites in Safari When Connected to a Router
Your broadband router may also be able to block websites depending on its brand and model if you’re not comfortable editing a host file in Terminal. The settings of your router can be accessed by following these steps:
- Find the IP address of the router. There may be a label on the bottom of the router itself. If you don’t have it, go to System Preferences > Network > Wi-Fi > Advanced and click TCP/IP. You can find the IP address next to the word ‘Router‘.
- Paste or type the URL into your browser’s address bar.
- When prompted, enter your router’s admin name and password.
- Visit the Settings page.
- Choose the option to block sites and enter the URLs of the sites you want to block.
Overall, these are some useful methods for blocking websites in Safari on Mac. You can prevent unnecessary usage and third-party involvement by websites on your device, which will slow it down over time. Therefore, by restricting websites, you can maintain the overall speed of your Mac. In addition to those reasons, Mac speed can also be slow due to many other factors. If you want to find out more about that and how to deal with it, read Why is my Mac so slow and how to speed it up.