How I Stopped Wasting My Precious Life on the Internet


I hate getting distracted. But with the increasing addictiveness of the web it’s becoming harder to prevent myself from reflexively checking sites like Facebook and Hacker News. That’s why I was excited to see a nice Python script called that acts as a DNS and schedules firewalls to prevent users from wasting time. I can block entire domains and specify timeframes during which they are allowed.

I wrote “Stay focused” on my local homepage. Annoying Facebook share and like buttons have also delightfully disappeared from my world.

My only complaint about is that I need to run it everytime the computer reboots. Another method, if I don’t trust my self-control, is to modify /etc/hosts. But unlike Linux, OS X Lion doesn’t support wildcards that would block entire domains like * I’d have to add a new line for each distinct subdomain.

Luckily, dnsmasq, a lightweight DNS forwarder and DHCP server, allows wildcards. Install Homebrew and run brew install dnsmasq.

Follow Homebrew’s post-installation instructions and check dnsmasq is running with ps aux | grep dnsmasq. Now, we need to configure OS X to add to our DNS Servers. Go to System Preferences > Network > (Select Connection, i.e. Wi-Fi) > Advanced > DNS. Add, in order,,, and The last two are Google Public DNS servers. I have to list other real name servers in addition to localhost, but these change based on what network I’m on. So it’s unreliable to list local name servers such as routers.

To add wildcard DNS entries to /usr/local/etc/dnsmasq.conf:


There’s no way to schedule a break for myself, but I think I’ll live.