Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Terminal prompt machine name changed to "new-host"

The terminal prompt reads
new-host:~ nero$
It normally starts with
nerombp17

This happened once before when my computer's name mysteriously changed to xxx (2) but after renaming the computer back to the original name, the terminal prompt also returned to normal.
This morning it's as shown above but the computer name is correct and has not changed.

I trashed the terminal preference file and repaired permissions (not that I thought it would help) and the prompt is still incorrect.

How to fix this? Where does the prompt get the computer name from? I presume it should automatically pick it up from the network settings or the computer name under sharing, but both those are correct.
And yes, I have rebooted, also no no avail.
I am looking through console logs, but don't see anything obvious yet.

Message was edited by: nerowolfe

Message was edited by: nerowolfe

MacBookPro3,1-17"Core2Duo/VistaUlt64SP1; MacBookPro1,1-15"/XPProSP3; Dual G5/XPP, Mac OS X (10.5.7), Homebrew 3GHz ASUS PC, Dell Inspiron8k, Abacus, Sliderule, HP-50G

Posted on Jul 10, 2009 9:53 AM

Reply
30 replies

Jul 10, 2009 11:22 AM in response to nerowolfe

From the same place the hostname command gets the host.

man 1 hostname
man 7 hostname
man 3 gethostname

Generally speaking this comes from the IP address (DHCP assigned IP address maybe), and then a reverse DNS lookup of the IP address to what the DNS server/DNS cache thinks is the name associated with that IP address.

You could try flushing your DNS cache, but that will not stop the DNS server from providing the same values again:

dscacheutil -flushcache # Leopard
lookupd -flushcache # Tiger

My work hostname looks like:
dhcp-location-x123-abcd-xx-xxx-xxx-xxx

I personally do not like this, so I changed my .bashrc so that it explicitly sets my PS1 variable to a name string I desire.

Because I use the same .bashrc file on several systems, I make some tests to see which Mac, Linux, Solaris, AIX system I am currently on. It is a bit complex, but it works for me, and avoids using the dhcp-location-x123-abcd-xx-xxx-xxx-xxx name.

Jul 10, 2009 12:25 PM in response to BobHarris

Hi Bob,
I did some further digging after the terminal name became "new-host-2" and I think it's my router doing the dirty 🙂
The router shows two computers for this box, the correct name and the new-host name.
Not so curiously, in Sharing Preferences, under File Sharing, the text says that my computer is available at both locations as below:

Other users can access shared folders on this computer, and administrators all volumes, at afp://new-host-2.home/ or "nerombp17".

I suspect that my router is being confused when I switch from Ethernet to WiFi, but at this point I am not sure, but it does seem that way when I browse my router GUI.

I only noticed this because it's unusual and new and those things are triggers for me.
This is the only computer that uses both Ethernet and WiFi and it's possible that they can both be on at the same time - I am not sure.
I don't know if the router is the cause or the result but I suspect the former.
I don't have any Windows boxes on at this time, and my other MBP which is connected via WiFi does not show any problems, and in the Finder on that box, this computer shows up with the correct name, not the new-host name.

I think I will reboot the router - not simply turn it off/on but do the full reset using the button.
I will then reboot this box and see what happens.
Since I am the infinitely curious type, these kinds of things are quite interesting and I don't let them go until they are resolved.
It certainly is an interesting issue.

Jul 10, 2009 12:48 PM in response to nerowolfe

Maybe you could try giving your Mac a fixed IP address (outside your router's DHCP range), assuming this is a typical home router situation and not a corporate router.

Give your Airport and your Ethernet interfaces the *EXACT SAME* fixed IP address.

I suspect that might stop your router from assigning new names to your Mac.

With this configuration you can switch between Airport and Ethernet and back again, always keeping the same IP address. With an identical fixed IP address on both ethernet and Airport you can even do this while in the middle of a file transfer and not miss a beat, except that in home transfers speed up when switching to etherent and the other system is also on ethernet.

The Mac has an ordering to its networking interfaces, and as long as your Ethernet is higher in the list than Airport, you will switch to the Ethernet when plugged in, and switch to Airport when ethernet is unplugged.

You can change the Service Order via the System Preferences -> Network -> Left side Column -> Gear icon -> Set Service Order.

Jul 10, 2009 1:18 PM in response to BobHarris

One of the Leopard Network options is DHCP with manual address. I think it's worth a try, but I still don't know the whyfor, since it's a recent thing. I have had this modem for several months since I got FIOS, and this is the first time (maybe the second) it's happened.
It's still not clear to me if the router is simply the result of the problem or causing it.
I will reboot later, with the Ethernet cable unplugged and AirPort off and see what happens.
I will look into the router GUI from my other MBP and see what shows up.

Jul 10, 2009 8:34 PM in response to nerowolfe

Solved
It was the router
When I unplugged the Ethernet cable from the box, and closed/reopened terminal, the prompt was correct. As soon as I plugged the Ethernet cable in, the prompt (after closing and restarting terminal) was the wrong one.
Solution:
I left the Ethernet Network settings alone, but changed the AirPort Network settings to use DHCP with manual address and used the same IP as the Ethernet connection.
Without a reboot, everything is back the way is should be.
Once caveat - I noticed that in the network settings, Configure IPv6 was set to automatic. I turned it off in both Airport and Ethernet. That's for a future time.

Terminal prompt machine name changed to "new-host"

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.