Web Developer & Photographer

One of the greatest time wasters today has got to be social-networking websites. More specifically, Facebook and Twitter. I found myself spending unnecessary amounts of time on both of those websites when I had nothing else to do. Let’s not lie, it’s an addiction, and many people are guilty of it besides me. Fortunately, there have already been temporary solutions such as SelfControl, a  freeware application developed by Steve Lambert. In the past I used SelfControl because it was simple and allowed me to setup a time frame that I could block out Facebook and/or Twitter. For students, I can almost certainly recommend using that application during finals week or when preparing for any exams in general. However, I wanted to stop frequenting Facebook on my Mac, so I needed a more permanent solution other than deactivating my account because I still want to be able to access Facebook from my iPhone. With a view commands in Terminal, this can be done in no time!

  1. Open up Terminal in /Applications/Utilities.
  2. In the command line, type in "sudo nano /etc/hosts".
  3. When asked, type your admin password.
  4. In the screen that will appear, you’ll see the host database for your computer.
  5. Using your down arrow, go to the bottom, right under where it says, " localhost".
  6. Type in " hit ‘tab’, then enter facebook.com”.
  7. On a new line, type in "" hit ‘tab’, then enter www.facebook.com"; this is for extra measure.
  8. Now, hold down Control + “O”. This will save the changes to the host database.
  9. Hit “Return” and then Control + “X” to exit the screen.
  10. Remove the existing cache by typing in "sudo dscacheutil -flushcache" in the command line, this refreshes the existing cache on the host database.
  11. You should receive an “Unable to connect” error message when you go to Facebook.com now.
  12. Now, back to doing something more productive…

screenshots: 1 2-3 4-7 10 11

  1. Wow this actually works, thanks!

  2. This is awesome! I’m going to use this during finals this semester. One question however… How do you undo it afterwards?

  3. Simple, just go back into Terminal following the same instructions and locate the website you blocked and remove it.

  4. Ignore the double period in 127.0..0.1. That was just a typo on my part.

  5. Cheers dude!

  6. I’ve tried a few times and it doesn’t seem to be working for me. Do you need to restart your computer or something?

  7. Totally works… thanks muchly

  8. Amazing! Thanks for this!

  9. This worked for me! Thank you!

  10. Heyy so I used this once a few months ago and it’s been working but I wanted to alter it. So I went back, deleted the websites I had out in there originally and saved then exited. I reopened it , and after entering the Sudo nano /etc/hosts it doesn’t ask me for a password.it worked before but now it won’t. It goes directly to the screen that’s supposed to come up next .Help ASAP

Comments are closed.