How do you block gmail through etc/hosts?
May 16, 2013 2:46 AM   Subscribe

Most "distracting" sites I can block by an entry in my etc/hosts file (Mac OSX 10.8.2). e.g.: But this method doesn't seem to be able to block gmail.

Here's the relevent lines in my etc/hosts file: localhost broadcastlocalhost
::1 localhost
fe80::1%lo0 localhost

But none of these seem to block gmail.

Does anyone have any suggestions?

I could try a "site blocker" but most of these rely on setting a "blocking time" e.g. 30 minutes -- this is not practical for gmail as I want to be able to log into it when I need to confirm my email address if I sign up to a site. I would prefer to be able to block gmail with the knowledge that I could unblock it in about 30s -- I find this "overhead" gives the best of both worlds.

I could also take Ritalin, and/or practice my self-control. That's also another option :).

NB: moments before I was about click "post" I was able to solve this. I'll post the solution then close the question in the hope it helps someone else.
posted by tomargue to Computers & Internet (5 answers total) 1 user marked this as a favorite
Response by poster: Okay, well, this is embarrassing. Initially I thought it was due a bug in Mountain Lions treatment of the loopback address:

In that you needed something like this:


But what solved it was restarting the computer.
posted by tomargue at 2:53 AM on May 16, 2013 [1 favorite]

I don't think URLs are valid entries in /etc/hosts. If I recall, it's just for mapping hostnames to IP addresses.
posted by RonButNotStupid at 4:43 AM on May 16, 2013 [3 favorites]

Yeah - /etc/hosts is only IPs and hostnames. The URL entries are not going to do a whole lot and you can safely delete them.
posted by jquinby at 5:13 AM on May 16, 2013 [1 favorite]

I use LeechBlock on Firefox, it does not require that you set a time for sites, you can have it turned on and block sites always, and turning it off when needed is pretty quick for me.
posted by effigy at 6:52 AM on May 16, 2013

You can flush the DNS cache and avoid the rebooting.

dscacheutil -flushcache
There's a layer between the hosts file or DNS server queries and applications where successful lookups are cached for a while to improve performance. They may also be cached in the application itself requiring an application restart to pick up changes.

If you want some finer grained control check if the `dnsmasq` application is available on Mac OS. It is a local DNS server thing... you configure your system to use dnsmasq as its DNS server, then configure dnsmasq to use your real DNS server. Then you can configure dnsmasq to return for wildcards like '*' and do real lookups for specific ''. A bit more power, but a bit more headache than editing the hosts file.
posted by zengargoyle at 11:39 AM on May 16, 2013 [1 favorite]

« Older Too good to leave, too bad to stay - therapist...   |   Can a Person Practice Dianetics and Not be a... Newer »
This thread is closed to new comments.