How To Block Websites In Safari On Mac.
While most of the websites you come across are usually informative and help you with the tasks you’re stuck with, there are other websites that mostly distract you from the work you do. These websites often work like magnets, and they keep you going for long periods of time.
If you find yourself surfing these sites for long hours, you might want to block these sites on your computer. Thus, you indirectly impose restrictions on yourself and make these sites inaccessible.
This feature also helps you block websites that you don’t want your kids to see. These could be adult sites or other sites that you think are not suitable for your children.
Regardless of the arguments, blocking sites in Safari on Mac is a fairly straightforward process and can be done in three different ways. Feel free to watch our video we made for our YouTube channel, which covers all the steps and doesn’t need to be read on your part!
Use parental controls to block websites in Safari on Mac
If you’ve looked inside the System Preferences panel on your Mac, you’ve probably seen this menu called Parental Controls. It lets you restrict the viewing of certain content on your Mac, and it also lets you block websites of your choice.
Click on the Apple logo in the upper left corner of the screen and select “System Preferences.”
When the panel opens, find and select the Parental Controls option.
Select the user account for which you want to enable restrictions from the left sidebar.
When the menu appears in the right pane, click on the tab labeled Internet.
Turn on the second option that says “Try to restrict access to adult websites” and then click the Configure button next to it.
On the next screen, click the + (plus) button under the Never Allow These Websites section to add a new website to the blacklist.
Enter the URL of the website you want to block and press Enter. Feel free to add as many websites to the list as you like. Click OK when finished.
The user will not be able to access the websites that you have blacklisted.
The list is customizable and you can add and remove websites at any time. There is even a section where you can specify allowed websites. It may contain your children’s educational websites and the like.
Modify the Hosts file to restrict access to websites in Safari on Mac
If you’ve ever tried to block websites on a Windows PC, you’re already familiar with the hosts file. This file can be used to restrict access to certain websites on your computer and is also available on the Mac platform.
You will use the Terminal application to open and edit the file.
Launch the Terminal app on your Mac, type the following command into it, and press Enter.
sudo nano / etc / hosts
Since this is a sudo command, you will be prompted for your administrator password. Enter your password and press Enter.
When the file opens, press Enter after the line with 127.0.0.1 localhost. This will allow you to add a new line to the file.
And here is the stage in which you actually block the site. Enter 127.0.0.1, press the spacebar, and then enter the web address of the site you want to block.
For example, if you want to block bing.com, you would use the following line:
You can blacklist as many sites as you like. Just make sure each website is on a new line and doesn’t change the prefix that is your Mac’s local IP address.
After you’ve entered the URLs of all the websites you want to block, press Control + O on your keyboard to save the file.
Exit file editing mode by pressing Control + X.
Back in your normal terminal window, enter the following command to flush the DNS cache:
sudo dscacheutil -flushcache
It will delete the DNS cache files so that these files do not interfere with the hosts file.
The websites you specify will remain blocked as long as they are in your hosts file.
Use an app to block websites in Safari on Mac
Both of the methods shown above use the built-in tools available on your Mac to complete the task. If you are not comfortable with them and prefer an easier option, you can use a third-party site blocking application on your Mac.
Sign in to SelfControl, a free Mac app that lets you focus by blocking unproductive sites on your computer. With this app, you can even define how long your specified sites will remain blocked. After this period, the sites you specified will be available again.
Download the application, move it to the Applications folder and launch the application.
In the main interface, click the Edit Blacklist button to specify your websites.
Click the + (plus) sign on the next screen to add websites to the blacklist. Optionally, you can even import websites to be blocked from the Internet.
Drag the slider on the main interface to adjust the block duration. Then press the “Start” button to start the blocking period.
The sites you have selected will remain unavailable for the period of time that you have selected in the application.
An additional feature this app provides is a list called a whitelist. What this list does is that it allows you to specify the sites you want to access, with all other sites on the Internet being blocked. Be careful when using this feature and only use it in certain circumstances, where only a few selected websites are allowed on the machine.