Apple has official instructions for changing or resetting an account password in Lion (Mac OS X 10.7) or Mountain Lion (Mac OS X 10.8 ); however that tutorial either assumes you already know an administrator password or have a Mac OS X installation disk.
But that’s pretty pretty useless if you have neither the password nor the disk. So in this article I wanted to show you two ways to reset the administrator password without a disk. I think Macbook Air users will find this article especially useful just keep in mind that you may lose your files after running this tool; therefore, make sure you have everything backed up.
The two most popular methods of resetting the admin password on the Mac (without the CD) are:
- Recovery Mode
- Single User Mode
In Lion and Mountain Lion you can use Recovery Mode to reset the password. Just restart the computer and hold down Command + r until the menu screen appears. Click Terminal from the Utilities Menu and enter this:
Single User Mode
The other option is to delete the Apple Setup file to trick the Mac into thinking it just came off the truck from the factory.
After deleting the Setup File and rebooting, you’ll see a “Welcome to Mac OS X” setup screen which will walk you through the process of creating a new admin account.
To make it happen, we have to boot into something known as Single User Mode. This is a limited environment with no graphical user interface but is very helpful when you need to perform advanced troubleshooting.
That’s what we’re going to do today.
Reboot the Mac and hold down Command + s to enter Single User mode. Keep holding down Command + s until you see a black screen with white text.
The command prompt is that right rectangle near the bottom of the screen. This is what it looks like on my Macbook Air:
At the command prompt enter this:
mount -uw /
This mounts the root file system (the forward slash /) and tells the computer to change the status of any already mounted file systems (that’s the -u part of the command) and make sure it’s read-write (the w in the command).
Press enter to move to the next line and type this:
This looks a little more cryptic than the mount command but it’s not too hard to decipher if you break it into groups.
The rm part removes directories. In this case, it’s removing a directory that lives in a /var/db/ called .AppleSetupDone
Deleting this folder is the trick that forces the Mac to think it has a new lease on life.
Press enter to move to the next line and finish up with this command:
shutdown -h now
The dash h halts the Mac at a specified time, in this case we’re saying, “Shutdown Now”
After executing this command, press the power button to turn the Mac back on and you’ll see the setup introduction screens.