How to Delete a Local User Using Command Line on Mac OS X

One user reported that she could not log on using her regular network account on a particular Mac computer. Her account worked on all other computers but not on this one computer. If we configured the login screen to list users, you could see that a local account by the the same name was listed. However, when we checked the System Preferences and tried to delete the account, the account was not there. We were therefore unable to delete the local user account.

This excellent post led me to resolve the problem. To search for a user, use this command.

/usr/bin/dscl . -search /Users name username

You can then use this command to delete the user.

sudo /usr/bin/dscl . -delete "/Users/username"

After I deleted this hidden local user account, my user could log on using her network account again.