How to Block Websites on Your Mac

  • MORE

Many web browsers offer plugins to help you stay productive, and not open the websites you waste time on, but you can take things one step further by simply blocking your computer from accessing specific sites all together.012

This is why I recommend editing the Hosts file on your Mac, using Terminal. Yes, it looks a little intimidating, but once you get the hang of it, you'll have banned those websites across all browsers, and doing so without relying on a plugin that may lose support when its developer grows tired of updating it.

The below steps were performed on a MacBook Air running macOS High Sierra (10.13), but they should work the same on all Mac from the last decade or so. 

MORE: Which MacBook Should You Buy? MacBook vs. Air vs. Pro

1. Click the magnifying glass in the top right corner. If it's not there, hit Command+Space.

How to Block Websites on Your Mac

2. Type "Terminal"002

3. Select Terminal. 003 3252651520011755

4. You've reached the command line, it's a little intimidating, but don't worry.004

5. I'm going to give you a series of commands to type in, and each will have quotation marks on the front and back, which you should ignore.

6. Type in "sudo nano /etc/hosts"How to Block Websites on Your Mac

7. Hit Return.

8. Type your system admin password.How to Block Websites on Your Mac

9. This is the host file database, tap the down arrow to move your cursor below the line that says "127.0.0.1 localhost"006a

10. Type in "127.0.0.1 " and then the address of the site you want to block, making sure to keep a space between the numbers and the address. For example, "127.0.0.1 facebook.com" will block Facebook.006c

11. Hit return.

12. Type in "127.0.0.1 " followed by that address with the "www." prefix in front of it, for extra measure. For example, "127.0.0.1 www.facebook.com"006d

13. Hit return.

14. Click Control + O to save your change.

15. Click Return.

16. Click Control + X.

17. Type "sudo dscacheutil -flushcache"011

 

18. Hit return.

Now, when you open that website, in any browser on that Mac, you'll get a message that says you're unable to connect. 012

Author Bio
Henry T. Casey
Henry T. Casey,
After graduating from Bard College a B.A. in Literature, Henry T. Casey worked in publishing and product development at Rizzoli and The Metropolitan Museum of Art, respectively. Henry joined Tom's Guide and LAPTOP having written for The Content Strategist, Tech Radar and Patek Philippe International Magazine. He divides his free time between going to live concerts, listening to too many podcasts, and mastering his cold brew coffee process. Content rules everything around him.
Henry T. Casey, on
Add a comment
3 comments
Back to top