When transferring a website from one service provider to another, you definitely want to test the new installation before changing the DNS records; e. g., you have example.com living at the IP address 184.108.40.206, and set up a new webserver at 220.127.116.11; now you want to test the new webserver, which possibly uses VirtualHosts, and therefore needs the domainname example.com in the HTTP-request. So, while leaving the DNS record at its old value (so that the rest of the world doesn’t see your new server after you have tested it), you convince your local computer that example.com lives at the new address. On Unixy systems, this is no problem: just add a new entry to the /etc/hosts file, and you are ready to go.
I was wondering if this also works on a Mac, with its fancy DirectoryService daemon; turns out, it does. Just add the line
18.104.22.168 example.com to your local /etc/hosts, and you are ready to test.
This is the nice thing about MacOS X – beneath its polished surface, there is still a raw Unix, and it knows how to behave.