How to reset lost password in Apple Mac OS X Lion

Today was the day when I needed to work with Mac computers running Apple Mac OS X Lion. Unfortunately no one in the office knew the password for the accounts on these machines. I had two options to deal with this. I can reboot and hold Control + R combinations of keys and wipe out the system — which is  time consuming and plus you will lose all the apps installed on that machine. Other way I was able to deal with this is  a create a new admin user in single mode, log in to system and reset password for the old user.

I like the 2nd option more and it takes less than 20 seconds 🙂

Reboot the laptop with Mac OS X Lion and while system is booting up hold Control + S combination of keys, this will bring the OS in single user mode

  • Once in single user mode – check file system .. use this command
/sbin/fsck -y
  • Next step is mount the file system, enter this command
/sbin/mount -uw /
  • If you receive no errors type this command
rm /var /db/.applesetupdone
  • Once done you can reboot the system
reboot

Wait for the system to reboot and now you should be welcome with well known screen to create a new user on the machine, follow up the wizard, create new admin user on the machine. Once logged on as the new user, go to Setings > Users Accounts, unlock and now you can reset password for the old user or you can remove the old user from the system.

I know there is other way to do it if you have the boot media which I did not have at this case. If you do have the media you can follow up also these steps – worked on Mac OS Tiger and Mac OS X Leopard and should work for Mac OS X Lion.

1: Insert the install media (CD/USB)
2: Restart the Mac and hold the ‘Alt/Option’ key
3: Boot from said media
4: After selecting the language you can change the password for any existing account (including admin) using the password reset tool found in the utilities menu.