Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Click here to return to the 'only changes prompt and shell's environment variable' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
only changes prompt and shell's environment variable
Authored by: wluh on Sep 10, '01 07:47:09PM

Unfortunately, changing the host name in this way does not allow you to ssh or telnet into your machine using that name. it only changes what the prompt says is the host name, i.e. if you set host = "mycomputer" then turn on sharing, and try to ping or telnet from another computer, it won't find it. And only "localhost" is honored if you try to browse on console any web pages that you have on your computer. (In fact, I'm not sure if the proposed solutions I've seen on this site's archives would have their hand-tailored hostnames honored by the network without registering with their parent domain).

The reason is that the "rc" file calls "tcsh.defaults" after setting the host environment variable and sets the prompt based on the string stored in the host env variable. These variables are set for the shell, not for the system.

[ Reply to This | # ]
The correct way to change your hostname
Authored by: pete_yandell on Sep 11, '01 02:55:51AM

All of the posts I've seen actually slightly miss the correct way to change your hostname on OS X.

The above technique doesn't actually change your hostname at all; you will still get "localhost" if you run the hostname command from a terminal. All it does is convince your shell that the hostname is different and therefore changes the prompt you get in terminal windows. If this is all you want to do then it may be a good solution.

To really change your hostname, your need to do two things:
1) Edit the /etc/hostconfig file and change the HOSTNAME= line
2) Open up NetInfo Manager, choose the "machines" directory, create a new subdirectory with the same name as your new hostname and add a new property to this directory called "ip_address" with a value of ""

The second step is very important and I haven't seen it discussed before. Without it, your machine may try to look up its IP address from its name and fail which can cause assorted problems like the one the previous poster described. (For me, printing from the command line using lpr was very broken until I performed this second step.)

As always, be careful playing with NetInfo Manager. You can break things very badly.

[ Reply to This | # ]
The correct way to change your hostname
Authored by: iloatheny on Jun 08, '02 06:50:25PM

Posts like this needs to be highlighted so it stands out from all the conflicting / outdated info regarding common troubleshooting issues like this one.

[ Reply to This | # ]