Changing the Host Name

ericmurphy

Registered
I seem to remember that under the OS X Public Beta, it was easy to change the host name of an OS X computer. For example, my computer's name is DeepBlu. It shows up under Appleshare on another computer as DeepBlu. But, if you open a terminal on my machine, it shows up as "localhost."

Is there a way to set the name of the host to DeepBlu? I can't seem to find which configuation file needs to be changed. If I had to guess, I would say it's /etc/hostconfig, but doesn't the host name there have to be a valid name that DNS servers won't object to?
 
I thought all you had to do was 'append value' or something like that...

then it shows, "deepblu, localhost" as the value

I also added the machine name in the hostconfig file, too. I think you have to do that if you want to get sendmail working as well...

How does the value look when you make a copy?

......haha, I guess I can just try... shouldn't be a problem as long as I don't save it.
 
You can do it in netinfo, too. Just look under 'machiens' or whatever, and where it says 'localhost' and '127.0.0.1' change localhost to whatever you want, or just add another entry under 127.0.0.1 with your custom hostname.
 
To change the hostname open Terminal.app, su to Root or use sudo depending on how your system is set up and edit /etc/hostconfig using vi. In there you will see a section which reads like this:

# Network configuration
HOSTNAME=-AUTOMATIC-
ROUTER=-AUTOMATIC-

Change the HOSTNAME= line to read as what ever you want your hostname to read. So for my machine it reads

HOSTNAME=vampire.home

When you reboot your system the new hostname will have taken effect. It overrides whats listed under netinfo.
 
What works for me:
Edit this file and change everyinstance of "localhost" with your preferred hostname:

/System/Library/StartupItems/Network/Network

Not graceful but it gets the job done.
 
Back
Top