0

I am on OSX, and my host name in the preferences panel reads "User's Computer Name" but when I go to my command line it is reading:

something else:~ myusername$

My understanding is the first part of the terminal prompt is always the machine name, however every indication from the GUI's on OSX seem to be that my machine name is different than what is displayed in the terminal.

What could cause the terminal first part to be different?

When I echo $PS1 I get:

\h:\W \u\$

If I check my hostname I get:

scutil --get HostName
HostName: not set

I have also tried the netbios name:

defaults read /Library/Preferences/SystemConfiguration/com.apple.smb.server NetBIOSName

steves-machine

and the local host name

 scutil --get HostName
    steves-machine
1

In the terminal you get the HostName, and that could be different than your ComputerName:

You can see both values by issuing the following commands:

scutil --get ComputerName
scutil --get HostName

Reference: http://osxdaily.com/2012/10/24/set-the-hostname-computer-name-and-bonjour-name-separately-in-os-x/

  • Thanks, but my hostname is not set, and my computer name is different then what is being displayed in the command prompt. – stevebot Oct 29 '14 at 20:55
  • @stevebot: You could also check the NetBIOS name: defaults read /Library/Preferences/SystemConfiguration/com.apple.smb.server NetBIOSName and the local hostname: scutil --get LocalHostName – Vlad Oct 29 '14 at 21:01
  • what if those are both different as well? – stevebot Oct 29 '14 at 21:05
  • @stevebot Time to take a deeper dive: superuser.com/questions/357159/… – Vlad Oct 29 '14 at 21:09
  • thanks, it looks like that question is correct. I must be getting a different name through the reverse DNS lookup. very strange. – stevebot Oct 29 '14 at 21:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.