Let's say you've fixed up a classic Mac Pro, and it's going to a new home. You've installed a new GPU and upgraded the OS to Mojave, maybe preloaded some useful apps like Macs Fan Control, or given the NVMe boot drive a better looking Finder icon. You don't want to completely reinstall macOS, you just want to delete your user account and let the new owner run through the Apple Setup Assistant first boot experience just like it was a fresh install. If you look it up, all the instructions online will tell you to delete /var/db/.AppleSetupDone, and then reboot into Single User Mode to delete your user account.
But wait, you can't use Single User Mode, because your new Mojave-compatible GPU doesn't have a Mac EFI. No boot screen = no single user mode! But have no fear, here's a surefire method to delete your own user account in Mojave, without Single User Mode, and prepare the Mac Pro to re-run the Apple Setup Assistant as if it were fresh from the Apple Store. (Should work on other Mac models and other versions of macOS too.)
Get ready. This process will all happen at once, without a reboot. It's committing harakari. It's the last time you'll ever be logged in to this user account. Make sure you've tidied everything up on the hard drive, backed up any files you want to keep, deleted anything you don't want to leave behind, and are completely prepared to say goodbye.
Bonus tips:
But wait, you can't use Single User Mode, because your new Mojave-compatible GPU doesn't have a Mac EFI. No boot screen = no single user mode! But have no fear, here's a surefire method to delete your own user account in Mojave, without Single User Mode, and prepare the Mac Pro to re-run the Apple Setup Assistant as if it were fresh from the Apple Store. (Should work on other Mac models and other versions of macOS too.)
Get ready. This process will all happen at once, without a reboot. It's committing harakari. It's the last time you'll ever be logged in to this user account. Make sure you've tidied everything up on the hard drive, backed up any files you want to keep, deleted anything you don't want to leave behind, and are completely prepared to say goodbye.
- Make sure you've deleted any other user accounts, leaving just one administrator account left.
- Log in to the administrator account you want to delete.
- Open a Terminal window.
- In the Terminal do cd ~ && pwd to determine the path to your user's home directory. We'll use this later when we delete the home directory.
- Now run sudo -s to open a root shell, then enter your password.
- Now that the Terminal's in a root shell, enter rm /var/db/.AppleSetupDone (Deleting that empty file will re-run Apple Setup Assistant on the next boot.)
- Leave this root terminal window open!
- Now to delete your user, open Directory Utility ( /System/Library/CoreServices/Applications/Directory Utility.app )
- In the Directory Utility window, click the lock icon in the bottom left to authenticate, and enter your password.
- Now choose Edit > Enable Root User. As root, you'll be able to delete the account you're currently logged in with. (If "Enable Root User" is greyed out, try File > Connect, Address: localhost. If it says "Disable Root User" instead, then you've already enabled root and can skip to Step 12.)
- Set a password for the root user.
- Now click the lock icon again to close the lock and un-authenticate from your current account.
- Next click the Directory Editor icon in the top of the Directory Utility window.
- On the Directory Editor page, click the lock icon near the top right, and authenticate with username root and the root password you just set.
- Now, in the left column, click on the name of your user account, the one that you're about to delete.
- Last chance to turn back! To delete the selected user account, click the — button (minus sign) in the bottom left corner of the window, below the column of user names.
- You should see the user name disappear from the list, indicating that user name has been deleted.
If the user isn't deleted, do this: with the same username still highlighted, click the GeneratedUID entry in the top right part of the window, then in the bottom right part of the window, change the last character in the alphanumeric string to something else. Then click the Save button in the bottom right corner, and now you should be able to delete the user as in Step 16.
- Almost done. To put things back as they were before, disable the root user that you just enabled. Choose Edit > Disable Root User.
(If that option is not available, you can type dsenableroot -d in the Terminal instead. When it asks for a password, enter the root password you created.)
- Now you've deleted your user account from the system, but its home directory files are still there. To delete the user's files, click back in the root terminal that you left open from earlier. (It will still work even after all that!)
- In the terminal, do cd /
- Now the last command. To delete the user's home directory & files: rm -rf /Users/username (where /Users/username is the path to your user's home directory you confirmed in Step 4.)
- All done! The only thing left is to power down: shutdown -h now
Bonus tips:
- You can check your work by booting into Recovery Mode, hold Cmd + R at startup before the boot chime. Your OS drive should be mounted under /Volumes/ and you can access its files in the Terminal. (if you have a recovery partition on your hard drive)
- If you've restarted into the Apple Setup Assistant, you can get a Terminal by pressing Ctrl + Opt + Cmd + T. Just in case you needed to do anything else to the system after deleting .AppleSetupDone. More on that here.
Last edited: