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