Apple's macOS is a secure operating system, and at the heart of its security is your password: you will need this whenever you install new software or make changes to macOS via System Preferences, usually when logging in (unless you log into your Mac with an Apple Watch) and sometimes when deleting important files. But what do you do if you've lost or forgotten the password, or it doesn't work? Don't panic. In this article we're going to look at how to recover a lost Mac password.

On a related note, if your Mac is asking you for your iCloud login, or Apple ID, then read about what to do if you forget your Apple ID password. Alternatively, if you have forgotton the password to the admin account on your Mac you may also find this article helpful: How to change the admin password on a Mac as it includes some additional methods.

Get a password hint

Before you reset your password, you should first check to see if the password hint (the hint is a phrase you entered into the hint box when you set up the password) refreshes your memory. To see the hint, you just have to make three incorrect attempts:

  1. Open System Preferences (Apple > System Preferences)
  2. Choose Users & Groups.
  3. Click the Lock icon at the bottom left.
  4. Press the Return key three times.

The screen will shake each time you press return and after the third shake the hint appears below the Password field. Don't worry: there's no limit to the number of times you can enter a test password.

How to recover a forgotten Mac password: Hint

If the password hint doesn't show up, that will be because it wasn't set to show password hints in the Login Options. Unfortunately, the only way to change this setting is to log into your Mac. Luckily there are other ways to find your password, so read on.

If you want to make sure that a password hint appears if you forget your password, you should go to System Preferences > Users & Groups > Login Options, then log in and tick the box that says show password hints.

Change the password from another account

Do you share the Mac with another person - some people do, in these days of remote working and hot-desking - and do they have their own account? Is there an administrator who looks after your work Mac? An IT guy (or girl) who might be able to log on? Or do you have a different user account on the Mac that you do know the password to?

If they (or you) know the password to another account for the Mac you can use this account to reset your password. Follow these steps to reset your Mac password from another account:

  1. Click on the Apple logo in the top left and choose Log Out.
  2. Select the account you do know the password to.
  3. Enter the password for that account.
  4. Open System Preferences > Users & Groups.
  5. Click the lock icon in the bottom left of the window.
  6. Enter the password again.
  7. Select the account you've forgotten the password for in the sidebar.
  8. Click Reset Password.
  9. Fill in the New password, Verify and Password hint fields.
  10. Click Change Password.

You have now changed the password for that account, and you can log into that account using the new password.

Note that this doesn't change the password for the Keychain and you will be asked when you log into the account if you want to update the keychain password. To do this you'll need the old password (which you have forgotten) so you'll have to click Create New Keychain.

How to recover a forgotten Mac password: Keychain

The problem here is that if the other user doesn't have Admin rights on the Mac they will not be able to change the password for you. The next option, if that didn't work, is to use Recovery Mode.

Use Recovery Mode to change your password

How to recover a forgotten Mac password: Use Recovery Mode to reset your password

Apple includes a tool to replace a Mac's password. This is the best option if you have completely forgotten your password. Follow these steps:

  1. Turn off your Mac (choose Apple > Shut Down).
  2. Press the power button while holding down Command + R. The Mac will boot into Recovery (we have a separate article about how to boot a Mac in Recovery).
  3. When you see the load bar appear you can let go of the keys. It may take a few minutes to load.
  4. Select Disk Utility and press Continue.
  5. Choose Utilities > Terminal.
  6. Enter resetpassword (all one word, lower-case letters) and press Return.
  7. Select the volume containing the account (normally this will be your main hard drive).
  8. Choose the account to change with Select the User Account.
  9. Enter a new password and re-enter it into the password fields.
  10. Enter a new password hint related to the password.
  11. Click Save.
  12. A warning will appear that the password has changed, but not the Keychain Password. Click OK.
  13. Click Apple > Shut Down.

Now start up the Mac. You can log in using the new password.

Stop someone else resetting the password

You may now be worried that if you can use Recovery Mode to reset the password, someone else could do the same thing - and once a person has got access to your Mac, you've usually lost control over it. There are some steps you can take to protect your data, though.

The best way to protect your data is to turn on FileVault encryption. This encrypts the contents of your Mac, and the Password Reset utility will not show until you unlock it with Disk Utility. When you set up FileVault you receive a Recovery Key (which you should print out) and a password. If you lose both of these your data will be lost forever.

You can turn FileVault on in System Preferences > Security & Privacy > FileVault.

Use Target Disk Mode

Finally, if you can't use any of the methods above, then your best trick is to use Target Disk Mode to recover what data you can from the lost Mac. This enables you to access the hard drive on your Mac from another Mac. Follow these steps:

  1. Shut down the Mac (Apple > Shut Down).
  2. Connect the Mac to another Mac using a Thunderbolt cable (if your Mac is old enough you might be able to use Firewire cable). Uunfortunately this trick does not work with USB. 
  3. Start up your Mac and hold down the T key while it boots.

The Mac in Target Disk Mode should now appear as a hard drive in the other Mac. You can use this Mac to recover data from the Mac.