Apple - How do I recover the administrator or root password on OS X?

Boot to OS recovery, internet recovery or on older systems, with a Mac OS X DVD, then there's an option to change passwords.

reset

You can follow an how-to here.


Getting admin access without the Setup Utility: another option, for the sake of completeness.

  1. Boot into single user mode by holding command-S on boot up.
  2. Enter /sbin/mount -wu / when the prompt appears to mount the filesystem
  3. Enter rm /var/db/.AppleSetupDone
  4. Enter reboot

At this point, it should run the colorful little setup utility that ran when the machine was new. This'll create a brand new admin account. This method can be useful if you don't want to mess up any existing accounts on the machine.

Before step 4 you can use the passwd command to overwrite the current password for any accounts on the mac. The command ls /Users will show all the user names.


You can reboot into single user mode and change the password of a user with:

passwd [user]

Enter the new password twice and reboot.