How to recover from a forgotten password for MacBook Pro?
Recovery HD

The simplest way may be to use the Recovery HD, but this won't work if you have FileVault enabled.


Boot into the Recovery HD (hold ⌥ alt/option at boot and select the Recovery HD).
Once it has booted, click Utilities, then Terminal.
Type resetpassword then ↩ enter.
Follow the instructions.


Restarting Setup Assistant

In addition to using the Recovery HD, you can also restart the Setup Assistant, create a new Administrator account, then use that account to reset the password to the original account. This process will work if you have FileVault enabled, although you'll have to unlock your drive first before mounting.

You can restart the Setup Assistant by performing the following:


Boot into Single User Mode (hold ⌘ cmd + S at boot).
Mount the drive by typing /sbin/mount -uw / then ↩ enter.
Remove the Apple Setup Done file by typing rm /var/db/.AppleSetupDone then ↩ enter.
Reboot by typing reboot then ↩ enter.
Continue setup, making sure not to transfer data.
Setup a new administrator account. You can use this account to reset the password to the original account (through System Preferences → Users &amp; Groups).



The new account can then be deleted once the original account has been recovered.