The other day, I opened my MacBook Pro a few hours after closing the lid and putting it to sleep. It wouldn’t wake from sleep. I tried several things to get it to try and wake up, but had no success. This has happened a couple times in the past, and I usually just hold down the power key to restart it. So that is what I did.
When it started back up and loaded the login page, I noticed something strange, my user was missing. I have 4 user’s registered on my computer and now only 3 of them were showing. So I logged in as one of the other users who an admin.
Upon login, I could see that my user’s account still existed on disk: /Users/doug When I went to the System Preferences, I did not list my user. I wasn’t sure what was wrong.
I began searching through the file system and found there is a file for each user in /var/db/dslocal/nodes/Default/users/ Example:
/var/db/dslocal/nodes/Default/users/doug.plist
I opened up doug.plist and found that it was a binary file. I could read some of the text in there and saw some mention of “Kernel” and other thing that suggested a stacktrace or dump. I opened up the plist for another user and found that it was standard XML.
So I copied the doug.plist from my Time Machine backup and replaced it with the one on my laptop. I rebooted and my account was restored.
I’m not exactly sure what happened, but the moral of the store is:
- Create a Time Machine Backup
- Have at least one other Admin user on your computer you can login to if all fails.