Instructions for the Mac OS X Password Recovery.
Although there’s no real way to recover a lost root password, you can change the root password even if you do not know the current one. You must have physical access to the machine in order to accomplish this task.
1. Click Restart at the login window
2. While the computer is restarting, hold down “Command-S” until you see text scrolling through the window. This boots the computer into single user mode.
3. At the Localhost% prompt type:
/sbin/mount -uw /
You will then see various services starting up.
4. When the Localhost% prompt reappears, type:
It will then ask you to type the new root password twice, so do so.
(Though I’ve not tried it, it appears you can type niutil -list . /users to get a list if users if you do not know the username….if someone wants to verify this, I would be most appreciative).
5. After entering the new password, type:
6. At the login window, enter the username with the new password. Once you are logged in, you can use the Multiple Users application (/Applications/Utilities) to change your user’s password, or create a new user account.
Note: this may not work for newer versions of OS X; I think they did something about it in a security update.