This if for 10.6 and older.

Reboot

Hold apple + s down after you hear the chime.

When you get text prompt enter in these terminal commands to create a brand new admin account (hitting return after each line):

  1. mount -uw /
  2. rm /var/db/.AppleSetupDone
  3. shutdown -h now

After rebooting you should have a brand new admin account. When you login as the new admin you can simply delete the old one and you’re good to go again!

For 10.7 or newer

You have to boot from a Lion Recovery drive, this can either be a recovery disk made with theLion Disk Maker tool, or just by booting from the built-in Lion Recovery HD partition.

  1. Hold “Option” at boot and select the “Recovery” disk at the boot menu
  2. Wait for “Mac OS X Utilities” menu to appear, indicating that you are booted into recovery mode
  3. Click on the “Utilities” menu and select “Terminal”
 
  1. Type the following:
  2. resetpassword