Deleted all users with "dscl . -delete /Users"
I don't know how I put myself in these situations.
So I was fooling around with dscl late last night, making and removing accounts, when suddenly I ran dscl . -delete /Users
instead of dscl . -delete /Users/someuser
.
So now I have no users on my machine, all that works is single user and recovery HD.
What do you think is the best way to fix this? It seems to me like doing the re-install from recovery HD will restore the system users and leave my files alone. I've found another answer from a few years back (link) where OP says the installer hanged (hung?) when he tried that. However, he was running 10.6, where I'm running 10.9, and the restore mechanism is different. Has anyone else been in this situation?
I'm thinking of doing the re-install and, if everything works fine, re-creating my user with the original home folder with DSCL. What I don't know is how safe that is.
Also, I don't have a backup of any kind.
All that really matters is not losing anything in my home folder. If I have to copy all of my files off to an external HD and do a wipe and install, I'll do it. I'd just like to avoid such extremities if at all possible.
Indeed, that should work.
Reinstall using the Recovery HD, then create a new user account with a unique name using the Setup Assistant. Once booted, you can open Users & Groups from System Preferences and create your original user again. Providing you use the same short name, this should prompt you to associate the existing home folder to the new user account.
However, you can't be too careful, and making a backup would always be wise. If you have OS X installed on an external drive (or are willing to install it on an external drive), you can boot into that and use that to obtain the files. Alternatively, you can boot into Single User Mode, mount another drive (mount /dev/disk1s1 /Volumes/externaldisk
) and copy the files over.