How to change hostname?


How do I change the hostname in MacOSX from 'localhost' to something of my choice?
I tried editing some of the scripts in /etc but they claim that hostname is maintained by the System Preferences panels. I also want the hostname to appear at he login window as it did in the Public Beta (I was able to configure the hostname in the PB because hostname was an option under the netwoking System Prefs Window).
I tried changing the name under 'Sharing' Prefs pane but it just reverts to "David Lee's Computer"
Help! I thought I was GOOD at UNIX....


Senior Member

I'm away from my Mac right now, but look at netinfo (nidump & niload). OS X, like NextStep before it, stores lots of the unix flatfile stuff (like /etc/passwd, etc) in netinfo and distributes it from there.



Super Cute Member
You can either do this through your regular login, but you have to enable root, and use the command line, or login to root and use Text Edit.

If you are logged in as yourself, make sure you have enabled root user from Netinfo Manager Domain > Security > Enable Root User. Then in the Terminal type "sudo vi /private/etc/hostconfig" then it will ask you for a root password which you should just gave it under Netinfo Manager. Where it says "HOSTNAME=-AUTOMATIC-", change "-AUTOMATIC-" whatever your hostname is (i.e. Then restart Terminal, and if you use the above example you'll see "[landry:~] whoeveryouare%" if you are using tcsh.

If you are gonna log in as root, well just go to the finder under the Go menu Go To Folder... type "private/etc/" then a finder window will popup. Open "hostconfig" with Text Edit. Then just change where it says "HOSTNAME=-AUTOMATIC-". You know the rest.

I hope I am clear, and helpful. Oh, I hope you know how to use vi if you are gonna do it with your normal login. :)