macOS
If you sign in to your Mac with an Apple ID, you can reset your Apple ID’s password to regain access to your Mac. The options on your Mac’s sign-in screen will walk you through the process. You’ll need a verification method associated with your iCloud account, like a mobile phone number.
Macs also have a built-in password reset tool available in recovery mode. You’ll need to restart your Mac by clicking the Apple menu and selecting Restart. Press and hold the Command+R keys as the computer boots and it will boot into recovery mode.
Once in recovery mode, select Terminal, type resetpassword into the terminal, and press Enter. You’ll see the Reset Password utility, which allows you to reset the password of a any user account on the Mac. You can also access this tool from a Mac OS X installation disc.
To protect yourself from this, we recommend enabling FileVault encryption (if it isn’t already—most Macs turn it on by default now). With FileVault on, you won’t be able to reset your password, so make sure you don’t forget it. If you do, you’ll have to erase your files and reinstall macOS to regain use of your Mac.
Macs also have a built-in password reset tool available in recovery mode. You’ll need to restart your Mac by clicking the Apple menu and selecting Restart. Press and hold the Command+R keys as the computer boots and it will boot into recovery mode.
Once in recovery mode, select Terminal, type resetpassword into the terminal, and press Enter. You’ll see the Reset Password utility, which allows you to reset the password of a any user account on the Mac. You can also access this tool from a Mac OS X installation disc.
To protect yourself from this, we recommend enabling FileVault encryption (if it isn’t already—most Macs turn it on by default now). With FileVault on, you won’t be able to reset your password, so make sure you don’t forget it. If you do, you’ll have to erase your files and reinstall macOS to regain use of your Mac.