Reset OS X Account With the Terminal In Single-User Mode

We all have those times when we change our admin password at night before we go to sleep and forget what the new password was the next day when we open up our Macs in the morning. Or, you might just have forgotten your account’s password, and are currently locked out of your OS X system.

You might have also used all the standard traditional methods to reset your password, yet failed. You’re now desperately looking for a final resort to getting access back to your account.

No worries though, as we’ve got another method that might just help you out. This method should allow you to reset an OS X account and restore access to your account via the use of Terminal Single User mode, which is a bit tricky, but extremely helpful.

Before we start, you should know: Messing around in Terminal’s Single User mode is extremely risky, and if you don’t follow each step below exactly as described, something could go terribly wrong. The risk is yours without responsibility on our part.

Now, this method will trick your system into believing that it’s never been set up before. All your system files, apps, personal data, etc., will remain untouched, but you should always have a backup anyway.

Disclaimer: Again, we can’t take responsibility for any damage done to your system by following this article. While this method is 100% tried and tested, if you don’t enter the Terminal commands below exactly as they’re written, or don’t follow each step exactly as it is, we wn’t be responsible.

Proceed below at your own risk, provided you’ve tried all other methods of trying to gain back access of your system:

1. Shut down your Mac if it is on.

2. Power on your Mac.

3. Once you hear the Mac startup chime, immediately press “Command + S” on your Mac’s keyboard.

Reset-Password-Command-S

This will open up Terminal in Single-User mode on your Mac. You’ll know that Terminal has successfully opened when you see white text appear on your Mac’s screen:

Reset-Password-Single-User-Mode

4. Now, enter the following commands into Terminal, one at a time. Press Enter after each command:

mount -uw /
rm /var/db/.AppleSetupDone
shutdown -h

This is What the above commands will do:

  • Mount the internal hard drive with write permission
  • Remove the Mac setup file. This is the file that OS X checks to determine if the system is already set up.
  • Shutdown the Mac

5. Your Mac should now automatically shut-down. Power it on by pressing the Power button, and you’ll be presented with the Mac Startup Setup screen, as shown below:

6. Go through the entire setup to set up a new admin account for your Mac. Follow each step in the setup carefully. Remember, this will most likely be a temporary account, so there isn’t much need to set up every OS X feature (iCloud, Keychain etc.).

Reset-Password-Setup

7. Once you’re logged in to this new account, open up System Preferences, either from Spotlight or by navigating to “Applications -> System Preferences”.

8. In System Preferences, click on “Users & Groups.” Once that opens, click on the Lock icon in the bottom-left corner to authenticate yourself.

9. Once you’re authenticated as a system admin, select the account whose password you want to reset from the left-hand pane. Click on “Reset Password” to change the password for the account, and hence, regain control.

Reset-Password-OS-X-Terminal-Method-Change-Password

10. Now log out, log back in to your original account, and continue with your work.

By using the above method, you should be able to regain access to your OS X machine. However, after going through situations like these, we always recommend two things:

1. Always have a system backup, that includes all your personal files, documents, etc. You can never know what’s going to happen to your PC/Mac tomorrow, and as it goes, it’s better to be safe than sorry.

2. If you change your password, or have a variety of passwords for different purposes, record them to somewhere safe. They’ll always come in handy sometime, especially in tough situations like these.

Let us know in the Comments section below whether the above method worked for you. If not, how did you regain access to your OS X account?