I've got a new Mac and I've noticed on the terminal I get a null instead of some kind of name there before on my previous computer.

Last login: Fri Mar  9 10:14:57 on ttys000
(null):~ Macuser$

I'm pretty sure thats not normal and occasionally it does fix itself! Why is it doing this?

2 Answers 2


I had the same problem too. Fixed it by following this trick

  • 6
    For preference it is better to summarise the answer and then provide an additional link. It may sound pedantic, but technically you haven't provided an answer, just a link to an answer. It might not seem important, but for readability of the question and answer together (particularly important where an answer is accepted) it is much better if they can be appreciated without requiring a user to leave the site - plus it shows that you have an understanding of the answer if it is in your own words. Thanks - Dan
    – stuffe
    Commented Mar 9, 2012 at 19:58
  • In addition to @stuffe’s comment, it would help if the OP would say how that helped them solve the problem and what the cause of the problem was. That link points to a very generic “how to customize the prompt” article. The mystery here is why it’s displaying “null” when it would normally display the current host name automatically by default.
    – Chris Page
    Commented Mar 10, 2012 at 20:48

Have a look in your .bashrc and .bash_profile... for instance I have the line

PS1="\[\e[0;32m\]\u@monkey:\w\$ \[\e[0m\]"

before fi to set my prompt.

  • Hard-coding the host name is usually undesirable, because you want it to reflect the current host name, which may change depending on the network it’s connected to, or if it is explicitly renamed. That’s why bash supports \h in PS1 to display the current host name.
    – Chris Page
    Commented Mar 10, 2012 at 20:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .