Saturday, October 18, 2008

Editing the Hosts Files in MAC OS X 10.5.5

Point Browsers on a MAC to a DEV Machine

All my work is done on a Windows box using MS Visial Studio 2008. It is easy enough to adjust the hosts files on a Windows box to see your work (C:\WINDOWS\system32\drivers\etc\hosts). So I can set up dev1.martinator.com in IIS and edit this hosts file so that dev1.martinator.com will point to the IP address on my machine (where my local web server resides).

Easy-Peasy as my daughter would say.

However, if I wanted to test my local build on a MAC, it is a another story. Apple makes things on a MAC easy, but only the things they want to make easy for you. The MAC I use at work is running OSX 10.5 (Leopard I believe). It took me about a half a day or so to find a clue on the Internet as to how to change the hosts file for a MAC running OSX 10.5. I finally found out how in a message on an obscure message board that I probably couldn't find again. Here it is:

  1. Open up Terminal
  2. sudo vi /etc/hosts
  3. put in your password
  4. press "a"
  5. paste/enter in your addresses, i.e.:
    101.505.39.99    dev1.martinator.com 
  6. press Escape
  7. press Shift+: (Hold down Shift and press the “:” button)
  8. enter "wq" and hit Return.

For older MAC's, look here: Mac OS X: How to Add Hosts to Local Hosts File

No comments: