From How to Geek
It happens to everyone at some point—you create a new password and don’t remember to save it somewhere, and then before you know it you’ve forgotten what it was. Here’s how to reset the password on your Mac OS X computer.
If you’ve got a Windows PC and you want to reset your password, you can do so easily with the Ubuntu Live CD or the System Rescue CD in just a couple of minutes. Or you could always crack your password if you wanted.
Luckily for us, OS X has some very simple tricks that can reset a forgotten password without going to a lot of trouble.
Method One: Using the Install Disk
The first method we will look at is the OS X Installation Disk, so grab yours and put it into the drive. Once you have booted off the disk you will need to choose your language, and then OS X will prepare the installation environment.
Then you will choose the Utilities menu and choose Reset Password.
Now you need to choose the volume with the account you need to change the password for, choose the account from the drop down, and generate your new password and password hint if you wish to use one.
Note: You may want to reset the ACLs while you are here since you have changed your password. Once you are done, you can save and restart the computer.
Now you can login to your OS X computer with your newly made password.
Method Two: Tricking OS X Into Running the First Boot
The other, and possibly easier way to get around a forgotten password requires booting into Single User Mode and removing a file that tells OS X that the first boot setup has run.
To boot into Single User Mode, you’ll need to reboot the computer while pressing and holding the Command and S keys after you hear the startup gong.
Once you have booted into Single User Mode you will need to mount the volume you need to get into. Most of the time this will just be your boot disk and can be mounted as “/”. This command will mount that for you:
sudo mount -uw /
Next we need to remove the file that tells OS X that its already done the setup:
rm -rf /var/db/.AppleSetupDone
Now we need to reboot using the very logical reboot command.
Once we boot back up it will be just like the first time you boot after install and you will see the Welcome screen, and just click through the first two screens.
When you reach the screen that asks if you already own a Mac, make sure to choose “Do not transfer my information now” since we’re not doing any migrating of data.
Once you reach the “Enter Your Apple ID” screen, you can press the Command and Q keys at the same time to get past the rest of the prompts. Click Skip when asked.
Now you will create a new Administrator account. You can choose to name it something you wish to keep or anything since you just need this account to get into the OS and to System Preferences.
Click through the next screens until you reach the Thank You screen, and we’re finally done with that part of the process. Click Go and you’ll be brought into the new account.
Once the new account has loaded you can now go to your System Preferences. We will want the Accounts pane.
Now select the account with the password you want to reset and click Reset Password…
Choose your new password, and password hint if you desire, and click Reset Password.
You can now logout and login to the account with the new password.