How to Block and Unblock Websites on a Mac
How to Block and Unblock Websites on a Mac
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 in several ways. The built-in Parental Control options are the easiest to use, but you can also block websites using the hosts file in Terminal with your administrator account, using third-party web browser extensions or apps, or even on your router. This wikiHow article teaches you how to block and unblock websites on a Mac.
Things You Should Know
  • macOS has its own built-in website blocker. It can be found in the "Screen Time" settings in "System Settings."
  • You can use third-party apps and web browser extensions to block websites.
  • You can also block websites on the administrative account by modifying the Hosts file in the Terminal.

Enabling Parental Controls

Click the Apple icon Mac Apple. It's the icon that resembles the Apple logo in the upper-right corner. It's 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.

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, it’s in the main Screen Time window at 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 Content Restrictions. In Ventura, 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 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 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 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.

Using Apps, Extensions, & Router Settings

Install a browser extension. Most web browsers have extensions that you can install, which allow you to block specific websites. You can install extensions that block websites on Google Chrome, Safari, and Firefox. Access the store for that web browser and search for site blocker extensions. You can access the Google Chrome store at https://chrome.google.com/webstore/category/extensions. You can access the Firefox extension store by typing "about:addons" in the address bar. You can download extensions for Safari in the App Store. Some extensions you can use to block websites include "BlockSite," "Stay Focused," "Simple Blocker," and more. Be careful of apps with low ratings or too few reviews to judge accurately. Untrustworthy extensions may install malware on your computer. This will only block websites on the browser the extension is installed on. Once the extension is installed, you can go into the settings and add or remove websites from your block list.

Install content-blocking apps. In addition to web browser extensions, you can also download apps that block content on your computer. There are plenty of apps that block websites for both parental control and productivity purposes. These apps include Net Nanny, Freedom, Cold Turkey Blocker, SelfControl, Focus, and more. Some of these apps block websites completely, while others allow you to block certain sites for a specific period of time. You will be able to block and unblock websites from within the app.

Adjust your router settings. Blocking sites on your router will prevent any device using the wireless network from accessing those sites. To access your router, you will need to find your IP address and enter it in your web browser. From there, the procedure will vary depending on what kind of router you have. To find your IP address, go to System Settings (or Preferences) → Network → Wi-Fi. In Ventura, click Details… next to your network. You can find the router IP address in the main tab or in the TCP/IP tab. For earlier versions of macOS, click Advanced, then click the TCP/IP tab. Copy the IP address listed after "Router" or "IPv4" and paste it into your browser's address bar. This should take you to your router settings. Enter the username and password to log in to your router. If you have never set these, look up the default password for that router model. (User "admin" and password "password" are common defaults.) Browse the router settings for site-blocking options. Each router brand has a different set of options, but most allow you to block sites in an area labeled "Access," "Content," "Rules," "Blocked Domains," or something similar. Add any websites you want to block. There will most likely be an option to click to add websites. Click this option and then add the website URL you want to block. Remove websites from the list to unblock them.

Blocking Sites with the Hosts File

Open the Terminal application. To do so, click the magnifying glass icon in the upper-right corner. 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 Enter.

Enter an administrator password. The Terminal should prompt you for your password. Type it in and press Enter. 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 Enter. 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 ↵ Enter. 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 enter 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 Enter 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". In theory, you can include multiple URLs on one line (entering the IP address only once), up to a maximum of 255 characters. However, this may not work on all versions of Mac OS X.

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 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.

What's your reaction?

Comments

https://umorina.info/assets/images/user-avatar-s.jpg

0 comment

Write the first comment for this!