Have you lost your Mac password? Are you unable to get into your computer because of it? Apple lets you restore your password if you have the system disks that came with the computer, or–if you have a newer non-optical disk machine like a Macbook–with the built-in system recovery mode.
If you aren’t able to access your system disks or the recovery mode, there’s a couple of tricky ways to reset your password. Both methods are explained in a video by Quinn Nelson on his YouTube channel, and they’re pretty great ways to reset a lost password.
A word of warning, though: this is also a way a malicious person can gain access to your Mac. If you have sensitive documents on your Mac, you owe it to yourself to use FileVault or a third-party encryption tool to add another layer of protection that doesn’t require your admin password.
First up, you’ll need to start your Mac up in single user mode. You do this by restarting your Mac, and right when you hear the start up chime, hold down the Command and S keys simultaneously. Hold them down until you see the little gear icon on your screen; you can let them go at that time.
You’ll see a black screen with white writing on it. This is like the Terminal app; you’ll need to enter in commands to make this all work.
To reset your password, try the following method first. If it doesn’t work (and it should for approximately 98 percent of Macs out there, you can try the next method.
In the single user mode screen, type the following in, with a Return key after each line:
mount -uw /
launchctl load /System/Library/LaunchDaemons/com.apple.DirectoryServices.plist
dscl . -passwd /Users/username password
You’ll need to replace “username” above with the user name you’re trying to reset the password for. You’ll also need to replace “password” with the new password you’d like your Mac to use. So, if you were resetting a password for username “killbill” to “1234,” you’d want that third line to read
dscl . -passwd /Users/killbill 1234
Make sense? Once you reboot your Mac, you’ll need to enter in the new password, and then reset your keychain (unless you know your old password, which begs the question of why you’re doing this in the first place).
If the above doesn’t work, try the next method. Get into single user mode as above, but this time, type in the following:
mount -uw /
shutdown -h now
What this method does is trick your Mac into thinking that it’s a brand new Mac. You’ll have to go through the entire process of setting up your computer with a second administrator account. Once you do so, however, you can log in with this new account, and then hop into System Preferences and Reset the password for your original account. It’s kind of tedious, but may be the best way for you to get back to your stuff.
Source: Quinn Nelson YouTube