Delete all OS X accounts in terminal when selling laptop 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.
Command Line Only

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


the user's home directory
the user's membership in groups
user's primary group
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 &amp; 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.