Apple - Issue with deleting user account
To add on to the existing answers and offer a different solution, you can securely erase the drive instead of just one user account.
If you want to sell your machine but also include installed software, there is a better way to set this up that will ensure none of your personal data is on the machine, as well as provide a better box opening experience for your buyer.
- I would suggest doing a secure erase of your hard disk first.
- Then, reinstall your OS.
- Configure a dummy user account named "test" or "admin" or something generic
- Install the software you want to include
- Restart your machine in Single User mode
- Very carefully, do the following:
mount -uw /(This mounts the root volume so you can make changes to it.
rm /var/db/.AppleSetupDone(This removes the flag that tells Setup Assistant that it's done)
rm /var/db/dslocal/nodes/Default/users/"shortname".plist(Replace "shortname" with the user account name you set up before. This removes the user plist)
rm -rf /Users/shortname(Replace "shortname" with the user account name you set up before. This removes the User directory)
rm -rf /Library/Preferences(This resets preferences)
shutdown -r now(This restarts the computer)
Verify that your machine starts up to the Setup Assistant and you're done. That way, your buyer can start up the machine to the Setup Assistant and still retain the software you want to provide them with.
The secure delete option can indeed take a long time. But if you really want all traces of your data to be removed from the media, you need to wait for it to complete.
If you want to quickly get all traces of your data off a machine, the quickest way is to physically remove the disk drives (believe it or not). This is what I generally recommend to friends who want to pass along a used machine.
If you really just want to preclude casual perusal of your old data, the secure delete option isn't necessary. You can just have System Preferences do a normal deletion.
A common misconception is that reformatting the drive and re-installing the OS will remove all traces of your data. This is not true! It's not much more secure than doing a normal deletion. (What makes it slightly more secure is that portions of the old data might be overwritten once when you re-install the OS.)
Yet another approach that might speed up the deletion process would be to delete a user account without chosing the secure delete account option in
System Preferences > Users & Groups.
Afterwards, on a still existing user account, overwrite the free disk space just once from Terminal.app (see Secure deletion: a single overwrite will do it).
ls -ld /Volumes/* man diskutil | less -p secureErase diskutil secureErase freespace 0 '/Volumes/Macintosh HD'