How to change /etc/hosts

It’s useful to change /etc/hosts, specially with protections requesting online keys.
After editing /etc/hosts, you need to refresh OS X NetInfo Database.
Just run the following command:

sudo niload -v -m hosts . < /etc/hosts

And then flush cache with:

lookupd -flushcache

For Snow Leopard the command has changed. It is now:

dscacheutil -flushcache

And that’s it!

Leave a Reply

Your email address will not be published. Required fields are marked *