Malfunctioning /etc/hosts file in OS X?
Asked by
zarnold (
713)
May 12th, 2008
I’ve edited my /etc/hosts file to prevent connections from my computer to several time-wasting sites, but I’ve found that only about half of the specified websites are actually blocked. Suggestions? Thanks!
Observing members:
0
Composing members:
0
7 Answers
What did you use to edit the file? Perhaps what you used is fucking up the line breaks.
could be; the only editor that allowed me the necessary access was nano.
The /etc/hosts file is not designed for “blocking” access to hosts. While it is used for this purpose occasionally, there are often better, more robust ways of doing so, as /etc/hosts can only be used to “redirect” requests to a local/nonexistant IP address.
If you could paste the relevant lines that are not giving you the desired effect, and what exactly you’re doing to test (visiting a given url in a browser, or something else) that would be helpful in diagnosing the problem. This isn’t for ad-blocking by any chance, is it?
Try flushing your DNS cache…
In Mac OS X 10.4 and earlier type:
sudo lookupd -flushcache
In Mac OS X 10.5 and later type:
sudo dscacheutil -flushcache
Looks right to me. Did flushing the DNS cache work?
it did seems to work now, but I’ll probably take giovani’s advice and look for a browser-based solution instead.
Thanks everyone!
Answer this question
This question is in the General Section. Responses must be helpful and on-topic.