/etc/hosts Replacement In OSXOn all *nix hosts you can add an entry to the /etc/hosts file so that you don't have to remember an IP address, can force your machine to always hit a certain IP for a given hostname, or any other number of reasons. This, technically, will also work on OSX, however it's a little flaky and not all programs abide by the /etc/hosts entries like they do on other platforms.
Enter `dscl`, or the Directory Service Command Line. Users of older versions of OSX might remember the NetInfo Manager, where you could go to edit OSX's build in LDAP-style server to add/modify/delete users, server names, etc. The NetInfo Manager application no longer exists in Leopard, so if you want to add your own host entry, here is how to do it.
sudo dscl localhost -create /Local/Default/Hosts/yourHost.yourDomain.com IPAddress 126.96.36.199That's all there is to it. The above command calls the dscl utility with root priviliges and adds an entry for the host yourHost.yourDomain.com to your machine's local directory. Now anytime you ping yourHost.yourDomain.com it will hit 188.8.131.52 instead of the previous location (whether that was nothing, because yourHost didn't exist, or another IP address, which you didn't want to hit).
If you'd like to list all of the host entries in your local directory along with their configured IP Address, you can use this command:
dscl localhost -list /Local/Default/Hosts IPAddress