
When Terminal loads, type the following exactly:.
At the “MacOS Utilities” screen, pull down the “Utilities” menu and choose “Terminal”. Reboot the Mac, as soon as the screen turns back on or you hear the boot chime sound, start holding down COMMAND + R keys concurrently to boot into Recovery mode. This is the simplest way to reset a password on a MacOS Sierra computer: For earlier MacOS versions you can also follow these tips for handling a forgotten Mac password meaning you’re not out of luck if you don’t have Sierra or a modern Mac OS release.
Before beginning, keep in mind that internet connected Macs running Sierra and other prior versions of Mac OS can also reset a password by using an Apple ID after incorrectly entering a password a few times, which may be a better approach for some users.
To be clear, this allows you to reset any password for any user on a MacOS Sierra computer, including for the admin account.