This is something that I need to do from time to time. And I thought I would post it here so it would be a bit easier for me to remember the command…. since I don’t do it everyday, I always tend to look up syntax.

I often move sites from a server to another or need to have something running on an internal network and using the hosts file is a great little tool for me to run tests.

So to refresh your Mac’s hosts file, you would do something like this:
sudo niload -v -m hosts . < /etc/hosts

The command prompt may very well prompt you for password (just so you know).

I’ll also credit a website that I’ve stumbled on a couple of times when I’ve looked up the command’s syntax…

Holy Shmoly! – how to update /etc/hosts

– EDIT –

Should also note that this applies to older versions of Mac OS X, like Tiger (10.4).

On more recent versions, you only need to edit the host file. Make sure you clear your browser’s cache!