Where does the word at the beggining of the prompt on my MacBook Pro terminal come from?

At the moment, it looks like this

Last login: Fri Oct 14 12:55:34 on ttys000
sherrythinkpad:~ ConfusedNoob$ 
sherrythinkpad:~ ConfusedNoob$ 

Obviously, the ConfusedNoob is my username - but where on Earth is sherrythinkpad coming from?


1 Answer 1


Terminal is showing you the first label of your BSD hostname (assuming your shell is BASH). If your BSD hostname is yourhostname.mynetwork.com then Terminal will display only yourhostname-

So from where does the BSD hostname come? It can come from several places:

  • From the file: /etc/hostconfig

  • Else from the file: /Library/Preferences/SystemConfiguration/preferences.plist (System ▸ System ▸ HostName)

  • Else the result of a reverse DNS query for your primary IP address (so you might notice a totally different hostname showing up when you visit an internet café than when connected at home)

  • Else your "Bonjour" hostname in System Preferences > Sharing (preferences.plist again... System ▸ Network ▸ HostNames ▸ LocalHostName)

  • Finally, if none of the above have been set, the BSD hostname will be simply localhost

  • #2 is where the default value of #4 is stored, not a separate thing. #3 is used before #2/#4, which is what ConfusedNoob is seeing.
    – Kevin Reid
    Oct 14, 2011 at 21:02
  • true, Kevin — yes, if you want to get specific. but since there is no place in the GUI, unless you have Server app installed, to set the former, I had to list the file.
    – username
    Oct 14, 2011 at 21:07
  • hang on a sec ;) #3 is most certainly not used before #2 — that would defeat the whole purpose. this is because #2 is a replacement for hostconfig, and is meant to allow one to override any other values, like a changing reverse DNS name. there would be no point setting a static hostname if it were to simply be steamrolled as soon as you connect to a network... aw crap, this is more complicated than the original poster probably wanted :(
    – username
    Oct 14, 2011 at 21:10
  • at any rate the original poster would likely not have a value defined for System ▸ System ▸ HostName unless he has installed the Server OS — the name he's seeing is likely the Bonjour name, unless he's got a public IP or a private DNS server running on his local network
    – username
    Oct 14, 2011 at 21:20
  • I think it must be 3. It isn't anywhere else and seems to change randomly... Oct 14, 2011 at 21:44

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.