I repair people’s Macs for a living. Often the task requires reinstalling the operating system, and installing updates. Before I return a computer to its owner I always remove the temporary user account I created, and reset the machine back to the Setup Assistant. By following these commands, the owner has the chance to connect to wifi, create a new user account, and sign into iCloud the next time they turn on their computer.

  1. Boot into Single-User Mode by pressing ⌘-S at startup.
  2. Once the command-line prompt appears type the following commands.
  3. mount -uw
  4. rm -R /Library/Preferences/
  5. rm -R /Users/username
  6. cd /var/db/dslocal/nodes/Defaultusers
  7. Type ls to list the contents of the directory.
  8. Delete the active user account, by typing rm username.plist where username is the name of the active account.
  9. rm /var/db/.AppleSetupDone
  10. reboot
  11. Mac OS X will restart, and the Setup Assistant will launch automatically.

If you are preparing the Mac for a new owner, press ⌘-Q and click Shutdown. The Setup Assistant run again the next time the Mac is restarted.

For Macs running Mac OS X 10.4 Tiger and earlier, follow these steps.

  1. Boot into Single-User Mode by pressing ⌘-S at startup.
  2. Once the command-line prompt appears type the following commands.
  3. mount -uw
  4. rm -R /Library/Preferences/
  5. rm -R /Users/username
  6. rm /var/db/netinfolocal.db
  7. rm /var/db/.AppleSetupDone
  8. reboot
  9. Mac OS X will restart, and the Setup Assistant will launch automatically.