A common way to "block" a website (eg, to eliminate it as a distraction) is to edit /etc/hosts
and point the domain to the loopback address. Eg:
# Stop goofing off
127.0.0.1 youtube.com
On Mavericks, I find that changes like this are seemingly ignored by the OS; after editing the file (with sudo) and saving, the site that should be blocked still loads.
I've tried resetting my DNS cache as follows:
dscacheutil -flushcache
sudo killall -HUP mDNSResponder
But the site still loads.
How can I get OSX Mavericks to notice a change to /etc/hosts
?
Best Answer
According to the the hosts(5) manual page, the
/etc/hosts
file is used bymDNSResponder
. Your attempts are correctly flushing the computer wide cache but you also need to flush the browser's private cache.After each edit of
/etc/hosts
reset themDNSResponder
cache using this Apple technical note, OS X: How to reset the DNS cache:After doing this, reset your browser caches: