Change an Admin Password in Mac OS X Single User Mode

This is a multistep process but it’s easy to follow:

    • First you need to enter Single User Mode. Reboot the Mac and hold down Command+S at boot to enter into the command line.
    • You’ll see a note where Mac OS X tells you that you need to run two commands in order to make filesystem changes, this is necessary so let’s handle that first
    • The first command checks the Mac OS X filesystem for errors and fixes them, it can take a few minutes to run:

fsck -fy

    • The next command mounts the root Mac OS X drive as writable, allowing you to make changes to the filesystem:

mount -uw /

    • After the filesystem is mounted, you can reset any users password using the following command:

passwd username

  • You’ll need to enter the new password twice to reset and confirm the changes

Don’t know the admin username? No problem
If you’re fixing someones machine and you don’t know the username to reset, just look in /Users with:

ls /Users/

Here you’ll see at least three items, .localized, Shared, and a username. The username is what you’ll want to change with the passwd command.

After the password is reset and confirmed, you can exit out of Single User Mode by typing exit or reboot. The Mac will now boot as usual and you’ll have access to the machine with the new password.

This is an easier and faster method than the approach taken for resetting lost passwords orusing the Mac OS X boot DVD, because it’s changing an existing root users password rather than creating a new admin user account. Both work fine though, so you can use whatever method you’d like.

You can use the same approach to navigate around a sleep/wake lock screen, although you’ll obviously have to reboot the Mac meaning you will miss whatever is currently on the users desktop.