• Skip to primary navigation
  • Skip to main content
  • Skip to footer

BobbyVoicu.com

Curious about stuff

  • Home
  • About Me
  • Blog / Archive
You are here: Home / Misc / How To Block Websites in the Host file on Your Mac

How To Block Websites in the Host file on Your Mac

March 30, 2021 By Bobby Voicu

I need to stop myself from using some sites too much, so I looked for a solution that didn’t involve using another app.

Once thing to keep in mind if using the solution below: it worked initially, but when I edited the file again it didn’t work anymore. I restarted my laptop and it worked, but I’m sure there’s another way you can force hosts to reload.

  1. In the command line, type in “sudo nano /etc/hosts”.
  2. When asked, type your admin password.
  3. In the screen that will appear, you’ll see the host database for your computer.
  4. Using your down arrow, go to the bottom, right under where it says, “127.0.0.1 localhost”.
  5. Type in “127.0.0.1 hit ‘tab’, then enter facebook.com”.
  6. On a new line, type in “127.0.0.1” hit ‘tab’, then enter www.facebook.com”; this is for extra measure.
  7. Now, hold down Control + “O”. This will save the changes to the host database.
  8. Hit “Return” and then Control + “X” to exit the screen.
  9. Remove the existing cache by typing in “sudo dscacheutil -flushcache” in the command line, this refreshes the existing cache on the host database.

From here: How To Block Websites on Your Mac Using Terminal – Mason Sklut.

◀Daylight Saving Time: Can We Just Decide on One?
Disco Elysium Final Cut on PlayStation▶

Filed Under: Misc

>>> If you want to continue the conversation, email me at me at bobbyvoicu dot com

Bobby Voicu

Bobby Voicu writes here from time to time.

Footer

About

I write about things that raise my curiosity. And I’m quite curious about all kinds of things.

For a full “About Me”, go here.

Recent Posts

  • My Bluesky ID: @bobbyvoicu.com
  • Batman is Here, on the Quest – XR Industry News of the Week – Oct. 24
  • XR Industry News of the Week – Oct. 10
  • XR Industry News of the Week – Oct. 4
  • XR News of the Week – September 14th, 2024

Friends

  • Sami the Westie
  • XR Gamer Digest

The CEO Library Collections

  • Best Leadership Books
  • Best Productivity Books
  • Women Entrepreneur Books

Copyright © 2025 · Privacy Policy · Disclaimer

We use cookies to enhance your experience. By clicking "Ok" or by continuing to use the site, you agree to this use of cookies and data.