This article was co-authored by Yaffet Meshesha and by wikiHow staff writer, Travis Boylls. Yaffet Meshesha is a Computer Specialist and the Founder of Techy, a full-service computer pickup, repair, and delivery service. With over eight years of experience, Yaffet specializes in computer repairs and technical support. Techy has been featured on TechCrunch and Time.
The wikiHow Tech Team also followed the article's instructions and verified that they work.
This article has been viewed 1,039,569 times.
Do you want to block or 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. While the built-in Parental Control options are the easiest to use, you will need to use the hosts file instead if you want to block sites on an administrator account. You can also block websites using third-party web browser extensions, apps, or block websites on your router. This wikiHow article teaches you how to block and unblock internet websites on a Mac.
Things You Should Know
- macOS has it's own built-in website blocker. It can be found in the "Screen Time" settings in "System Preferences."
- You can also block websites on the administrative account by modifying the Hosts file in the Terminal.
- There are third-party apps and web browser extensions you can use to block websites.
Steps
Enabling Parental Controls
-
1
-
2Click System Preferences. It's in the drop-down menu that appears when you click the Apple icon.Advertisement
-
3Click Screen Time. It's an icon that resembles an hourglass. Click this icon on the System Preferences menu.
- If you are using an older version of macOS, click Parental Controls instead.
-
4Select 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 version of macOS, click the lock icon in the lower-left corner and enter your user password. Then click the user you want to restrict.
-
5Click Content & Privacy. It's at the bottom of the sidebar menu to the left.
-
6Click Turn On. 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 button again to turn content restrictions off.
-
7Select the Content tab. It's the first tab at the top.
- On older versions of macOS, click the Web tab at the top of the Parental Controls menu.
-
8Select "Limit adult websites." It's the second option next to "Web content." This attempts to block adult websites while surfing the internet.
- Alternatively, you can select "Allowed websites only." This will block all websites except for the ones you allow.
-
9Click Customize. It's below all options next to "Web." This allows you to customize what sites you want to allow and restrict.
-
10Click +.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.
-
11Enter the URL for the website you want to block and click Ok. Enter the web address for the website you want to block next to "URL." Then click Ok.
- If you want to remove a website from the restricted website, click the website you want to remove and click the "-" button at below the box.
-
12Click Ok. This saves your list of allowed and restricted websites. Any websites in the "Restricted" list will be blocked.
Using Apps, Extensions, & Router Settings
-
1Install 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 to your computer.
- This will only block websites on the browser the extension is installed on.
-
2Install 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 purposes, as well as productivity purposes. These apps include; Net Nanny, Freedom, Cold Turkey Blocker, SelfControl, Focus, and more.
-
3Adjust 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. Use the following steps to adjust your router settings:
- Go to System Preferences → Network → Wi-Fi → Advanced, and 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.
Blocking Sites with the Hosts File
-
1Open 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.
-
2Back 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:[1]
- 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.
-
3Enter an administrator password. The Terminal should prompt you for your password. Type it in and press Enter. The cursor will not move from its position as you type your password.
-
4Open the hosts file. To do so, type sudo /Applications/TextEdit.app/Contents/MacOS/TextEdit /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.
-
5Skip past the existing text. Your hosts file should already have several IP addresses linked to "localhosts." Never edit or delete this text, or your web browsers may stop working. Place your cursor on a new line at the bottom of the document.
- If you are using the main Terminal window, use the arrow keys to reach the bottom of the page.
- A few users have reported a bug where adding new text to the hosts file only works if you add them above the existing text.[2]
-
6Type 127.0.0.1 below all the other text. This is the local IP address. If a web browser is directed to this address, it will fail to reach the web page.
-
7Hit the space bar, then 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.
- The hosts file only checks for the exact URL you enter. For example, "google.com" will only block the Google home page. You will still be able to access google.com/maps, google.com/mail, and so on.
- Do not copy-paste from another document. This can introduce invisible characters that prevent the text from working.
-
8Add more URLs you want to block on new lines. To do so, press Enter and begin a new line with 127.0.0.1. 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".
-
9Close 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.
-
10Type the command dscacheutil -flushcache into Terminal and press [{keypress|Enter}}. 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.
- You may restart your computer instead to get the same effect. In many cases, the sites will be blocked even without this step.
-
11Troubleshoot. 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.
-
12Remove 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.
Expert Q&A
-
QuestionHow do I block a website on Safari?Yaffet MesheshaYaffet Meshesha is a Computer Specialist and the Founder of Techy, a full-service computer pickup, repair, and delivery service. With over eight years of experience, Yaffet specializes in computer repairs and technical support. Techy has been featured on TechCrunch and Time.
Computer SpecialistEach browser will have it's own security and privacy settings where you can add sites you want to block or unblock. -
QuestionHow do I use Parental Control without needing access to an Administrator account?Community AnswerThis can't be done. An Administrator account is required to change Parental Control settings.
-
QuestionIs there any way to do this without a password?Community AnswerNo. An Administrator account is required to change parental control settings.
References
About This Article
1. Open System Preferences.
2. Click the Screen Time icon.
3. Click Content & Privacy.
4. Click Turn on in the upper-right corner.
5. Select Limit adult websites.
6. Click Customize.
7. Click + below the "Restricted" box.
8. Enter the website you want to block and click Ok.
9. Click Ok.