Have you forgotten your OS X password? Maybe you bought a second hand Mac and don’t know the password, or even the username? This quick guide will solve your troubles.
- Shutdown your Mac
- Start the Mac whilst holding down Command + s
- The mac should boot to a command prompt with white text on a black background.
- Type: sh /etc/rc
- Now if you know your username, skip to step 9, otherwise follow on…
- Type: cd /Users
- Type: ls
- You are now looking at the contents of the Users folders where the users’ home directories are. The directories will match the names of the users, ergo you now have a username to change the password for. (You may need to repeat this if there are multiple users until you find an admin user.)
- Type: passwd username – where username is the name you want to change the password for.
- You now type a new password and confirm it.
- Type: shutdown -r now
- The Mac will now reboot and you can log in with your new password. From here, you can set up new user accounts via System Preferences etc.
I hope that helps someone out there.

I have seen my friend encountering with the same problem that he usually forgets his Mac password, the reason for this is that he keeps changing his password. Though he doesn’t have problem with the user name. This post will definitely help him out. I will forward your link to him.
Thanks.
Oh, this is great. Thanks so much for posting this! You definitely found someone who needed this:)