Edit the hosts file in place of NetInfo Manager.app

September 27, 2009 / How to get your local virtual hosts back in OS X 10.5.

Firstly, the following is old news to most people for whom it would have ever been news at all.

But anyhoo, there are at least two ways to set up Mac OS X 10.5 to recognize hostnames other than localhost (e.g. being able to access a local site using http://mydomain.dev) in place of the defunct NetInfo Manager.app:

  1. You can use the dscl command line utility to set up virtual hosts (e.g. sudo dscl localhost -create /Local/Default/Hosts/mydomain.dev IPAddress 127.0.0.1).
  2. Or you can edit /etc/hosts (e.g. by adding 127.0.0.1 mydomain.dev to the end of the file).

Number two is easier since the file is “watched” for changes by the system. As soon as you add the entry and save the file Apache will be able to use it. By the way, this is all assuming you have set up your virtual hosts using Apache’s httpd.conf.

Comments are closed.


Zero to One-Eighty contains writing on design, opinion, stories and technology.