Mac lost password - lost OS X root password

Wow, I thought I'd get really secure when I took my MacBook Pro on vacation recently. So secure that I managed to forget the root password after I changed it. (duh) Fortunately I found an easy way to change it after I lost it.

I was lucky enough that I created one of my login accounts as an administrator ("Admin") account, and that's all I needed. Well, that, a Terminal, and the sudo command. :) Here's what I did.

Mac sudo command - changing the root password

First, I logged into my Mac system using that admin account. (For instance, if the account name was "Fred", I logged in as the user Fred.)

Next, I opened a Mac Terminal window. (If the Terminal icon is not on your Dock, click Applications on the Dock, select the Utilities folder, then click Terminal.)

Then I typed this command into the Terminal:

sudo passwd root

The system first prompts me for the admin account password (i.e., Fred's password), which I enter. Then it asks me (twice) what I want the new root password to be. I enter the new password, quit the Terminal application, and I'm done. That's it, that's all.

FWIW, if you don't have access to an admin account I think you can still reset the root password using the installation CD, but I haven't tried that yet.