Suddenly, this morning, I open a Terminal window and I get this:

I have no name!@macbook:~$ whoami

** I am not a number! I am a human being! **

What gives? Anyone know what I need to do to get my name back?

I suppose there are two problems here, one is that my hostname is undefined, the other is that whoami reports my name as a number.

  • 2
    BTW -- for those interested, i logged out (command-shift-Q) and after logging back in and restarting terminal, the problem is gone! Still interested in what may have caused this, if for no other reason than to advance the state of my McKnowledge. – ipd Mar 16 '12 at 18:16
  • Are you asking why the computer host name is displayed in the prompt or are you asking why the computer is named “I have no name!”? – Chris Page Mar 17 '12 at 1:58
  • I am asking why, suddenly, my bash prompt displays "I have no name!" rather than a hostname. Perhaps its just a coincidence that whoami is also reporting my number rather than my name. – ipd Mar 19 '12 at 18:59
  • 1
    What do hostname and id -p return? – Cajunluke Mar 19 '12 at 19:33
  • my system has returned to normal. Good suggestion though, if it happens again i'll check them both! – ipd Mar 20 '12 at 18:03

Something in memory got corrupted, and the mapping between your userID (502) and your username (ipd) was lost. I've seen it happen (usually when I've manually killed hung system processes), although I'm not sure exactly what causes it. launchd maybe?

Because that mapping is lost, whoami can't convert your ID into a username so returns the ID, and your prompt defaults to the "I have no name!" message because you effectively don't have a name.

Logging out and back in might fixit, but restarting is the best way (as you discovered).

Basically, it's a symptom of another problem, and not a problem in and of itself.

| improve this answer | |
  • 1
    I wish I could explain just how that mapping gets lost, but I've never dug deep enough to figure it out. – Bobson Mar 27 '12 at 16:16
  • This just happened to me again. I had killed launchd, and I was now 501, which prevented me from using sudo. I still don't know whether launchd will restart itself, or what else not having it running will affect. – Bobson Sep 23 '12 at 3:42
  • For what its worth, I just ran into this on a Linux machine, so I would guess the root cause is something in bash. strings /bin/bash | grep "I have" – Digital Trauma Dec 16 '15 at 20:03
  • This also happens on sandboxes, where it is common to not have whoami or even its dependencies, try which whoami to see where it is, in my case I did ldd /usr/bin/whoami to find dependencies, see if you have them and or if they are damaged. – RomuloPBenedetti Jan 12 '19 at 1:47

I see it's an old thread, but here is the solution to this problem (without restarting the whole computer).

The problem is in the opendirectoryd daemon and the earliest reports date from the beginning of 2011. Restarting the daemon (switching users with an admin one via Fast User Switching) fixes the problem.

While writing this answer, I've found a similar question in the Serverfault here, which also covers my answer.

| improve this answer | |
  • This didn't work for me. My symptoms are perhaps a wee bit different. I have a number of terminal windows open, and every existing terminal window has lost its username mapping, but every new window seems to have it without problems. Killing (aka restarting) opendirectoryd did not help. In the "failed" terminals, I also am missing group mapping for com.apple.sharepoint.group.2 and access_bpf, but not groups listed in /etc/group. Seems to me that old terminal processes (and who knows what else) have lost access to opendirectoryd, not that opendirectoryd itself has failed. – ghoti Sep 8 '17 at 2:47

This happens to me randomly when I resume from standby (i.e. opening my laptop). A log out or reboot is the only way for me to fix it. I don’t know exactly what causes it. As I type it is happening right now. As the comment in the original post asked, I ran id -p and it crashed. (Crash report: http://pastebin.com/nmFFQELq)

Console commands:

whoami — returns 501

id -p — crashes

cat /etc/passwd — my user is not in the document.

Any ssh attempt fails with the error:

You don't exist, go away!

I also checked out the console, from waking up, a bunch of random "Socket not connected" errors appear (which I think might be normal, being that wireless doesn’t connect immediately) from programs like Dropbox. An interesting error appears though:

4/12/12 8:37:09.045 PM coreservicesd: _scserver_ServerCheckin: client uid validation failure; getpwuid(501) == NULL

4/12/12 8:37:09.400 PM coreservicesd: _scserver_ServerCheckin: client uid validation failure; getpwuid(501) == NULL

Still not sure what is causing it, but thought I would share these diagnostics.

I’m on a Mid 2009 MacBook Pro with 10.7.3 installed.

| improve this answer | |

See if the permissions of the file /etc/passwd are set up like this:


because it reads the user name from the passwd file.

| improve this answer | |
  • It was 644, not 744. Setting to 744 did not help. – ejmin Nov 29 '16 at 8:56

I solved the problem by using iterm=>preferences=>URL_handler and connecting whoami to my username .. after restart on iterm, problem was no more

| improve this answer | |

I had this same baffling problem today (Lion 10.7.5) and dscacheutil -flushcache fixed it for me, as suggested in a comment in some blog.

| improve this answer | |

My problem is the permission in passwd archive, The old permission is -rw------- 1 root root 1280 Jun 9 15:41 passwd I used the command "chmod a+r /etc/passwd" and now all users can read this archive. -rw-r--r-- 1 root root 1280 Jun 9 15:41 passwd Logout the user and try. =)

| improve this answer | |

Go to the home folder in Terminal and run . ~/.bashrc.

It works!!

| improve this answer | |
  • 5
    I don't think re-sourcing .bashrc solves the problem here... – nohillside Oct 23 '12 at 7:56

You must log in to answer this question.

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