When we want to sell or give our Mac to someone else, it will be helpful if we can just reset the OSX back to setup assistant. So it will go back to the state like the first time we bought it. Here’s the trick.
Enter single user mode, then mount root partition with write access.
$ mount -uw /
$ rm -rf /Library/Preferences
$ rm -rf /Users/username (change username to your existing users)
This is the new one, for leopard and snow leopard
$ rm /var/db/dslocal/nodes/Default/users/username.plist
$ rm /var/db/.AppleSetupDone
You’re done, reboot your machine and see it will startup to the Setup Assistant. Fresh as new