Forgot your account password on your Mac? Try this:
Apple includes a tool with macOS or Mac OS X (depending on which version you are using) to replace a Mac's password. This is the best option if you have completely forgotten your password. Follow these steps:
- Turn off your Mac (choose Apple > Shut Down).
- Press the power button while holding down Command-R. The Mac will boot into Recovery mode. When you see the load bar appear you can let go of the keys. It may take a few minutes to load.
- Select Disk Utility and press Continue.
- Choose Utilities > Terminal.
- Enter resetpassword (all one word, lowercase letters) and press Return
- Select the volume containing the account (normally this will be your Main hard drive).
- Choose the account to change with Select the User Account.
- Enter a new password and re-enter it into the password fields.
- Enter a new password hint related to the password.
- Click Save.
- A warning will appear that the password has changed, but not the Keychain Password. Click OK.
- Click Apple > Shut Down.
Now start up the Mac. You can login using the new password.Source