Terminal Machine Name Different To Actual Machine Name

Hi,

This is only a minor thing but somewhat irritating. When I start a terminal session, the name of the machine is shown as:

Last login: Sun Nov 18 12:12:48 on ttys000
sandpit:~ myusername$

Well the machine name isn't sandbox, in fact it's called 'mavis', so why is it displaying as 'sandpit'??

😟

Message was edited by: Lee Powell 2

PowerBook 12 1Ghz G4, Mac OS X (10.4.4)

Posted on Nov 18, 2007 4:21 AM

Reply
11 replies

Nov 18, 2007 1:03 PM in response to Lee Powell 2

Hmmm... is this in a business environment? Sometimes in an environment with Windows doing the DHCP and DNS the machines register their names in DNS, and when the Mac gets it, the machine name comes down and the Mac uses that. It was easy to manually hardcode in OS X 10.3 and older by editing /etc/hostconfig and setting HOSTNAME but in 10.4 and 10.5 that's not an option.

Double check your "sharing" for Computer name also and ensure the computer name and the local hostname are set... you set the latter with the "edit..." button under the hostname.

Nov 18, 2007 1:15 PM in response to mathias wedeken

Hello Mathias,

If I remember well the hostname from the Sharing Preferences was put in the /etc/hostconfig file BEFORE Tiger, but migrating to Tiger would leave it there, so that you t h i n k Tiger got it from the Sharing Preferences...

If there was no line like: HOSTNAME=machinename inside /etc/hostconfig then Terminal would go and try to find the name by doing a reverse IP-address-lookup...

Anyway... I just added a line HOSTNAME=blabla inside /etc/hostconfig, rebooted and guess what???

Yes Sir... Terminal would now use that blabla as it's promt.

When (inside Terminal) you type: setenv HOST abc
it would immediately change the prompt to: abc

So it is probably driven by the variable $HOST

The real prompt however is the value of $prompt

When you type: set | grep prompt
You would see: prompt [%m:%c3] %n%#

So to really fix your problem I would use a command like: set prompt = machinename
or try to find out what exactly this [%m:%c3] %n%# stands for...

Nov 22, 2007 4:45 AM in response to Lee Powell 2

Lee

What do you get from
grep HOSTNAME /etc/hostconfig

If you get something like "-AUTOMATIC-" that would account for it changing. If you want a fixed one, do as Adam suggested in his post above.

Although William suggested this is not an option in 10.4 and 10.5, it works fine for me, but then I'm in a Mac only environment and a router does the DHCP for me (in fact I think I set it up for fixed IPs).

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Terminal Machine Name Different To Actual Machine Name

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