Getting locked out of your MacBook after forgetting your password is annoying, but it doesn't mean you have to wipe the machine clean to use it again. If you’ve assigned your Apple ID to your user account a password reset takes only a minute, but it’s also possible to reset using an OS X installation disk.

Use Your Apple ID

Beginning with OS X 10.7 Lion, you can attach your Apple ID to your MacBook’s user account. If you had the presence of mind to do this before you forgot your password, click the arrow-in-a-circle icon on the login screen to bring up the “Reset Password” dialog. Enter your Apple ID and that password, and then click “Reset Password.” Enter a new password, confirm it, add a hint and click “Reset Password” to continue. Now you can log in using your new password.

Using an OS X Installation Disk

For OS X 10.6.8 and earlier, or if you didn’t associate your Apple ID with your account, you will need to find an OS X installation disk. Insert the disk and reboot the MacBook while holding the “C” key to boot from the disk. After choosing a language to continue, select “Password Reset” from the Utilities menu for 10.6 or later, “Reset Password” from Utilities on 10.5 or 10.4, or “Reset Password” from Installer for 10.3. Select your hard drive volume, then select the name of your original administrator account. Enter a new password, confirm, click “Save” and exit the installer. Reboot and log in with your new password.