I need to control myself. So far, I was using a Windows device for work, where I would simply reroute Facebook, news sites and similar to In near future, I will have to use the same device (running OS X) for both private time and work.

I need a way to “switch off” a set of domains from my machine, similar to what I was doing with the hosts file in Windows. But since it should not be permanent, I also need a way to shut it off again.

There is no need for a huge blockage that I cannot overcome myself for the next xx hours, I'm not addicted - it's supposed to be against the quick “let's check this news site” reflexes during work time.

Does anyone know of any free software that does this or is able of hacking this into AppleScript quickly?

Bonus: Set up a second routine, that starts the “ban everything” script say 8 AM, and runs the “unban everything” script at 6 PM.

  • It should be perfectly possible to create a script to do that. I would probably use bash or perl, not applescript though.
    – Fyrefly
    Jul 15, 2014 at 14:03
  • There are dozens of browser extensions and apps that do that automatically. Would that be acceptable, or are you really looking to do it through AppleScript or something?
    – Tuesday
    Jul 15, 2014 at 15:07

1 Answer 1


I highly recommend the app SelfControl: http://selfcontrolapp.com

You can use either a whitelist or a blacklist of websites and you can set it for a specified time limit. It's great for either blocking the sites you know will tempt you, or allowing only certain sites you know you'll need.

You can also edit the hosts file at /private/etc/hosts to block sites. Here is a site with instructions: http://www.mactip.net/how-to-edit-the-hosts-file-on-a-mac/

Similarly, it’s possible to block a harmful domain by mapping it to the localhost. Thereby preventing the computer from reaching the domain. In this situation, map the bad domain to It will not be able to connect.

So all you have to do is add a line like this:    badwebsite.com

to your hosts file.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .