MacOS – Delete all OS X accounts in terminal when selling laptop

accountsmacmacosterminal

I have an old macbook with some photos on it that I'm trying to sell. I want to keep the OS on there so that someone new can use it, but I have to wipe it through terminal because the screen is mostly broken.

How can I delete all accounts on my Mac and leave it with a fresh install with no DVD and a mostly broken screen?

Note: I don't have a video out adapter. I know that would be the easy option, but I'm a sucker for the Terminal.

Update: I used this article http://en.kioskea.net/forum/affich-73393-change-mac-admin-password-without-the-disk

It gives me a new account and the computer starts up as if I just walked out of the store with it, but it says that the other account still exists.

Best Answer

Command Line Only

It looks like there are a four things that need to be deleted:

  1. the user's home directory
  2. the user's membership in groups
  3. user's primary group
  4. the user's actual account along with their password hash

The University of Utah Mac Managers group submitted a scrip to CodeSnippets to handle this. Credit for this answer goes to Chealion.


Use of Another Mac with FireWire & Install Disk

Boot the MacBook into target disk mode, connect it to your other Mac via FireWire, clean wipe the hard drive, and install a fresh copy of the OS.