In case it ever crossed your mind, when you are at the command line, never type

sudo dscl . -delete /Users/rob

when you mean to type

sudo dscl . -delete /Users/proxy

It will slow down your productivity.

Of course this is an understatement. dscl is the Directory Services Command Line utility on the Mac (man page). What I effectively did was to delete the computer’s knowledge of my existence, though not deleting my actual files. In this regard I was better off than sudo rm -rf / which you should also never type.

The Problem

Immediately after this I was still able to perform some functions on the computer. I could not run anything with sudo because it returned a who are you? error. I could still launch some applications, though not all. I had Safari already running, and I frantically Googled for advice on my problem.

The Fix

Eventually I worked up a strategy, based on many forum posts that did not quite answer my questions. I would retrieve a backup of this missing file, reboot into single-user mode, and replace the file.

Although you access user account information with dscl and other programs, there is an actual file that represents all this data. For me it was (and I do mean was) stored at /private/var/db/dslocal/nodes/Default/users/rob.plist.

Since I fortunately had an SSH connection already established with my home computer (I do not know if I could have established a new connection in my situation), I remotely opened the Time Machine disk image for my laptop. I navigated to where the rob.plist file was there and dumped it to my terminal with cat.

I copied this text to my local clipboard and then pasted it into a local file—actually two local files to be safe: /tmp/rob.plist and /Users/rob/Public/Drop Box/rob.plist.

I rebooted into single user mode (hold down Cmd-S at restart) and ran fsck until it reported Filesystem Not Changed. I mounted the drive with /sbin/mount -uw / and copied rob.plist to its original location.

After rebooting I could not log in. The login window shook itself whenever I typed in my password.

I rebooted into single user mode and tried using dscl to manipulate my account record thinking that maybe it needed to “validated” or something. I tried deleting the JPEGPhoto key and changing the Password key to something trivial.

This time after rebooting I was able to log in and go through the process of changing my password back again.


Be very, very careful mucking about with stuff like dscl! (It reminds me of the time I dd

-ed over the first 20 MB of my hard drive while I was at a hotel. There was no easy fix to that.)

If you have to go through this process sometime, I hope you have a backup of that plist file! I have left a backup copy in the same directory to help if I do this again.