Mac OS X Recover Lost Root Password

For the sake of security, having unique, complex passwords is recommended. Most people have a hard time remembering these and will eventually forget one. Forgetting the root password on a Mac system can seem devastating, but this tech-recipe will show an easy way to recover.


If you have the password to an account that is an administrator on the system, then it is easy to recover the password using the sudo command. Open a terminal window and type the following:

sudo passwd root

You will be prompted for your password (the user account that you do remember). Then you will be prompted for the new root password twice. That is it!

The sudo command is a helpful way to control who can do what on a system. In this case, since the user account is considered an administrator, the sudo command allows you (after confirming that you are who you say you are with the user password) to run a command as if you were root. The command we are running is passwd root which is the command to change the password for the root user.

If you do not have an administrator password, either, you can still reset the root password. Boot the system from the Mac OS X installation CD and select the Reset password option from the installer screen and follow the directions.

The Conversation

Follow the reactions below and share your own thoughts.

  • thomas bowen

    Daughter has only one account on Mac and doesn’t remember her password. I can’t load any new software. Any help? I tried the sh /etc/rc then passwd username it prompted me for a new password. I typed in the new password but nothing actually typed. It asked me to repeat it (even though nothing actually appeared) I typed in what I had the first time typed in reboot and after it rebooted, I went to daughters account tried to get in, but it said we didn’t have the right password. A little help would be nice. Thanks

    • Patrick J

      > First of all, the reason i didnt type anything when you typed in a pasword is because it isnt supposed too, for security reasons there is no text when you type a new password. Somthing that you could try is this: when booting up wait until you hear a chime, then hold command(key with apple logo) -S until a black screen with white text shows up. then type in these commands in to the terminal, hitting return after each one.

      mount -uw/
      rm /var/db/.AppleSetupDone
      shutdown -h now

      Follow any prompts that show up (remember, no text shows up). that will set up a new admin account from that admin account you can change your daughter’s password.

  • jason myers

    this not only worked on the password problem but i never had to reload any programs thanks a million!!!!

  • Nikki G.

    OK I have a MAC OS X
    Lost password
    NO administrator account
    Only One
    Can’t find software
    HELP

    • krikor

      > forgot my password to myMAC DO X any help?

  • kathy

    Wow thank you so very much! It worked the very first time!

  • les

    i lost my disc.s for back up and for got pass word to get in to my mac g4

  • jB

    Bad Title!
    In no way does this recover the lost password!
    It is useful for resetting the password.
    Important difference.

    • Ad

      Hi Can anybody help me? I couldnt remember my password to my ibook so i used this 1. boot computer and hold the “apple” key and the “s” key.
      2. wait for terminal show
      3. release keys
      4. type without the quotes: “/sbin/mount -uaw”
      5. press enter
      6. type without the quotes: “rm /var/db/.applesetupdone
      7. press enter
      8. type without the quotes: “reboot”
      9. press enter
      which worked great but when i got into my ibook everything that was on it had dissapered!! can anybody tell me how i can get the photos and music back that is on the system somewhere my hard drive is only showing 5 gig available and im about 9gig missing if somebody could tell me how to access these files i would me most gratefull Thanks

  • Manda

    Will this work with filevault active?

  • rex2930

    how do u no wth version of Mac Window base do u have i currenly los my passwork and my master password but tried everything wth u guys had down there Mac OS X 10.4 but do u do that if u cant get into your on Mac

  • rex2930

    I realy need your help i am getting frustrated badly step 1 to 5 works fine but when i try to do step 6, is says the following rm/var/db/ : no such fle or directory wth am i doing wrong Please write back ASAP

  • http://graffitibadges.com keef

    thank you very much, your instructions worked a treat.

    i was trying to delete some files that were locked and hidden inside an app. v frustrating for a control freak like me. now very happy your simple instructions allowed me to change the root password, which i had forgotten. still wondering what it was… ???

  • Mohit

    Thanks a lot . i helps. I was able to change my password. I am really new to mac and linux, so dont know so many commands

  • Anonymous

    I have a Mac Mini with OSX 10.5.6.

    I have an admin password, and used your recipe to obtain another root password. However, when I try and log in the a new terminal window with the new root password it says “unknown command”

    What have I done incorrectly?

  • Matt

    If my MAC is stolen how does this prevent anyone with a leopard disk from recovering my password for my file vault account?
    ie: change root password, then change account password, then login, and steal company files?

  • Erkan

    Hi I can not acces command s . And forgot password and master and don.t have installation cd. Is there any diferent way ?

  • thomas

    i just baught this cpu and i dont have the cd but there is a password on it that i dont know what it is every time i try to download any thing it asks for it but i havent the foggiest. if any one knows how to get rid of this or knows any thing about these cpus please help im now ofically lost. please help me

  • http://www.synchrony1.com/ Joe T Lor

    I can not start my G4 lost the password OS

    • Shiv

      well this is quite a simple one and might not work for you, but if you have any other account on your mac( admin) then you can simply
      1. go to system preferences
      2. select the user from the left sidebar
      3.click reset password.
      4. it will ask you for a new password.

  • http://www.in2town.co.uk in2town

    it is good to know that you can get advice, i recently lost my password so i will try this and see if it works

  • SK

    I want to reset password on my mac. Today morning it asked me to login with user name and password, it never asked me admin password. I entered the correct password but it is not working. I tried to reset the password and hint using OS X disk, but it still not accepting my new password. I can see the password hint changed, but whenever I try to do some administrative task, it will ask me admin password and reject it. Please help me to solve this issue. I can login to my account using OS X disk but when I will enter my admin password to do some administrative task it is rejecting my password.

  • carlos

    where do i type that? whats the sudo comand?

  • Anonymous

    Hi everyone,

    I tried to reset password via….

    1. boot computer and hold the “apple” key and the “s” key.
    2. wait for terminal show
    3. release keys
    4. type without the quotes: “/sbin/mount -uaw”
    5. press enter
    6. type without the quotes: “rm /var/db/.applesetupdone
    7. press enter
    8. type without the quotes: “reboot”
    9. press enter

    But now it just comes up with a select language page and when I choose english it loads up the System Administrator account. I can not log in as anyone else even if I create new users. In this state I try to log out, shut down etc, but nothing happens. Does anyone know what has happened here. Help is so so appreciated.

  • Anonymous

    Thank You!!! You are our hero! This saved us such headaches! Our computer will not be a paperweight! Good luck to everyone!

  • George

    I need to reset my administrator password on my mac. I have followed instructions according to the apple website but it doesn’t work. When I attempt to open the install disc on the computer it asks me for the password. Kinda defeats the purpose, I don’t know the password. Is there anyway around this or am out of luck.

    Please help

  • Anonymous

    I recently bought an iMac G3. Ido not know the password. I am using a windows keyboard. When I boot m mac the windows + s has no effect! If you can please help me that would be great.

    • Anonymous

      After you type the above commands and reboot I notice that the white screen shows up for 30 seconds then boots into original user. I never see the prompt I just type the commands but never see any typing but it does reboot when i hit enter I am using an external screen.

      Am I supposed to enter a password when the white terminal screen shows up?

      Please help

  • Anonymous

    i have a imac with 10.5.8. i just bought an old imac g3 with 10.3. i dont have the passwords for the g3. i have taken the hard drive out and connected it to my new imac. but i still can not change the passwords on the hard drive. is there a way to do this.

  • Mike

    Worked like a charm! Thanks!

  • Anonymous

    IT WORKED
    U THE MAN

  • Anonymous

    hm…interesting…

  • Joel Garfield

    This was very helpful. Thank you. I forgot the password to my old iMac, lol. Thanks again.

  • zadova

    This one worked fine on a recent (Nov 09) iMac with MacOSX 10.6.2 of a friend who had forgotten his initial admin password account: Thanks “lewisj”

    1. boot computer and hold the “apple” key and the “s” key.
    2. wait for terminal show
    3. release keys
    4. type without the quotes: “/sbin/mount -uaw”
    5. press enter
    6. type without the quotes: “rm /var/db/.applesetupdone
    7. press enter
    8. type without the quotes: “reboot”
    9. press enter

    The computer reboots as if it was brand new and I could create a new admin account. The guy had only used it one day so nothing was lost when I erased the account with its lost password.

  • Nelly

    I have tried everything I have read on here but my admin password does not seem to be erased. Every time I go back, it still there and waiting for me to type it in but forgot the damn password.

    I do need serious help because I cannot install anything, And when I ran the disk, it deleted everything operating to an old system not updated. So no current flash or office working. :( Need serious help to unlock the admin password and get a new one.

    Some give me some better instructions. I have done all I read on here and some others from somewhere else successfully going through it but I still find the password hint waiting for me..
    Can anyone help please..

  • Anonymous

    For some reason my Mac won’t accept my password though I have not changed it. I have my original start up CD and have tried as per mac instructions to reset password + I have gone through the internet trying everything suggested with the same results; it keeps asking for the original password/the password I’m putting in is incorrect!

  • Anonymous

    Hi, my problem is that i cannot type any command while the installation DVD starts the installation up, so i cannot access neither the Utility or the Single user mode…
    Any Hints?

  • Anonymous

    hello

    i forgot my password , i musing mac os x 10.6
    and want to change my password but i forgot password .

    thanks

  • Anonymous

    hello i got a big problem i hope someone can help me..
    i bought i mac pro from someone i wanted to change the account that i did with no problem and then i wanted to change the login code. i did that by using the cd everthing worked fine but when i reboot my system i cant login anymore. my password is “wrong”. i tried to restart by disc wont work. i tried to do it without cd with the cmd+s wont work either. any button when i reboot the system wont work. I really dont know what to do and i really hope someone could help me! because i just got mij mac and i dont want to trow my money away.

    thanks

  • Anonymous

    ok so I do not have an admin account and I need to reset the root password, other ways??

  • Anonymous

    Thank you so much , i recovered my root password.

  • Anonymous

    What if I do not have the install CD?

  • Anonymous

    1. Insert the Mac OS X Install disc and restart the computer.
    2. When you hear the startup tone, hold down the C key until you see the spinning gear.
    3. When the Installer appears, choose Utilities > Reset Password.
    4. Follow the onscreen instructions to change the password.
    5. Quit the Installer and restart your computer while holding down the mouse button to eject the disc.

    • Anonymous

      Thanks, Marckdon. That’s great information to add to this tutorial!

    • unclenice

      Thanks man your tut really helped save me alot of grief cheers and to the whole people here with their input you *ROCK* guys cheers.

  • Prodigal_1

    Take Note, this will also erase all programs, files and media. You will have to reinstall from Time Machine or manually reinstall all desired files!

  • Bryancommeaux

    i hav a mid 2010 mac mini i reboot the osx but there is no option to reset password after clicking utilities it just takes 45 min to reinstall the osx.

  • Mcdojan

    Lost admin password. Cannot reboot on OSX install disk. I have upgraded to 10.58 but the install disk is 10.3 and it won’t allow me to boot from it.

  • Sharonte_r

    Hello,
    I bought an Apple laptop from my job (thrift store) & it has a promt password, is there any way I can figure it out or change it without knowin the previous password?

  • Laurel 1234

    How would you do it if you don’t have the CD?

  • Anonymous

    you can try to google Password Genius

  • Anonymous

    Last time I forgot my password and tried everything i could do but failed, until I found this great tool Password Genius. It works great, and you can google it.

  • aroo-roo-roo

    Hi I ran a clean on my laptop and accidentally deleted all keychain names including my administrator name. I know the password but I don’t remember my admin name?? I would really appreciate if someone coul help with this. I can’t get updates or anything because I don’t know the admin name but i do know the password …what a problem eh?

  • Bollywood21m

    Dear Expertise ple help..I am suing Imac version10.5. As there was some problem in display i was suppose to take my imac to services dept. Now, i dont wanted to give away my personal data so i have deleted my user account with the home folders. Now i have a doubt tht is it possible to get the user account wid the home folder easily or it is not possible or if possible then how much time will it takes. As the user account or folder is not be deleted from trash..so ple guide me or suggest me what shld i do to save guard my data. thx.

  • Joseamedina10

    I CAN NOT OPEN A TERMINAL WINDOW/TO TIPE THE SUDO COMMAND

  • sm535

    I am using Mac OS 9 and have the same problem. But pressing ‘apple’+’S’ key does not send me to the single user mode in Mac OS 9 – it shows me a screen with a picture of harddisk, a circular arrow and a straight arrow. The harddisk icon is not clickable. The straight arrow proceeds with the boot (leading to a login screen that do not remember password of). I am not sure what the circular arrow does.

    Can someone help?

  • Homas45

    I have a macbook pro with tiger 10.4 on it its a A1278 model The admin password was change now I cant boot grey screen My dvd os x is broken cannot get to boot please respond thankyou what shall I do

  • Alexa44

    Thank you so much

  • Mrtauch779

    i have imac osx 10.4.11 cant unlock file value/ my kids play game try download game /so they deletd some things / now only 4*4 screen log in at adminadmin /// you are unable to log into the user account ‘adminadmin’ at this time. i need help i try everthing seem didnt work so help me i got only 1 computer .thank you.

  • mjdl23

    Thanks for this! I recently lost my root password and I changed it using this method. :)

  • Mannyceo13b

    i got an imac for free and i think i now know why it’s maybe becauce it’s password protected so i don’t really know how to over ride it all that i can really think of doing is installing the os but in order to do that it says that i need an andmins name and passward which i don’t have so my only real option is to open it up and install a new hard drive i would suppose

  • http://www.facebook.com/people/Nathan-Brown/642679473 Nathan Brown

    so i did the whole type stuff in to reset the add min user thing and it work but now after the step where it asks to make a admin account it restarts the video does any one know what i did wrong

    • Michael

      All I want to do is out my admin password not reset HELP!!!!!!

  • Aaron Wilson

    worked like a charm, thanks.

  • Norberto M. Tiongson

    Pls. help me to reset my log in password. I brought it to apple service provider here in the Philippines.and bought installer disc. but my CD ROM has a problem and not spinning. I had also installer disc which I used to upgrade mac OS from tiger to leopard. but this leopard installer now don’t run.
    any help that u can extent to me is highly appreciated

  • Romi Savini

     Hello, you can help me?
    I did what you said but I made a Huge mistake and erase  my user and appears a: “no such file or directory” 
    additionally, I think that my CD reader does not work so i cannot reinstall the OSX 10.5 
    OH good, any help would be amazing. I have to write my dissertation so … well i am not in my best moment!
    Romi

  • Giada Condor
  • Sarrithkumar

    Hi All,
    I’ve Mac OS X OCEG4, actually i was using this last some years and important datas also there. Now the problem is, I forgot user name as I knows the password and the hint also… I don’t know how can I login in to… pls help me…

  • Phil

    I tried all the other methods and this is the only one that worked and it was easy.  I doesn’t let me create another password for the administrator but it does allow me to set up my own password and identity and I have full access to the computer.  I didn’t lose any files or programs as was mentioned in another reply that I saw.  Thank you so much!!

  • pumpkin

    I have a Mac mail account. I opened several years ago.
    It was Not connected to a computer.
    I cannot figure out how to find my forgotten password.
    Can you help?

  • Christopher Levins

    @zadova OMG YOU ARE SO AWSOME THANKS SO MUCH I FINALLY GOIT IN MY MAC !!! THANKS!!!

  • Stephanie

    I was donated a used Mac iBook Laptop for one of my students to use. The only problem is that I have no idea how to get past the needed “Admin Name” to reset the password.

    The person who donated it has no clue, either, as she was given the unit without a CD or anything else, by a person she can’t track down???

    So, in attempting a good deed, I find myself just plain stuck!
    Please help me! A smart little kid is waiting for some kind of magic to happen in her life.

  • Hemant Jadhav

    Worked well on MACOS 10.6.8
    Thanks

  • vbg

    Thanks – it worked word to word – great help

  • Nageswara Rao Bitra

    thanks a lot!! it really helped me.

  • padma

    I have a mac os x version 10.6.2. I have misplaced my installer CD and need to reset my password as i have forgotten my old one. can you help.

  • Runcy

    Awesome! This worked like a charm

  • Carl Wainwright

    Thanks – Resolved my issue…

  • Jed

    Hi I use the method below and it does change password but when I shutdown or restart my macbook it then goes back to the old settings and I am locked out again. I have to redo the method below as I have tried countless other methods no other ones seem to work.
    I did notice it saying ‘mount read only’ and wonder if this is the cause for it?
    The method mentioned below works temporarily and resets itself back to old password when restarted or shutdowned. PLEASE HELP FOREVER GRATEFUL

    1. Shut down your computer
    2. Turn on your computer while pressing Command+S
    3. You will see command line. Do not be worried.
    4. Type in /sbin/mount -uw /
    5. Type in launchctl load /System/Library/LaunchDaemons/com.Apple.DirectoryServices.plist
    6. Type in dscl . -passwd /Users/username password
    7. Replace username with the Account Holder’s First Name and Password with the password you want it to be.
    8. Type in exit.
    9. At the log on screen go ahead and log on with your new password

    • alain

      i try to do all the comand on my mac but at the endwhen i wrote shutdown now or reboot nothing happen dont know what when wrong

    • alain

      i try to do all the comand on my mac but at the endwhen i wrote shutdown now or reboot nothing happen dont know what when wrong

  • asad

    Hi mate

    How you doing?

    I am using a Imac OSX 10.6.8 2010 TO 2011 range.

    PLEASE HELP! I have tried your instruction & i cant get the command line (:/ root#). after the line:

    a new line appears with having many folders that i real dont understand, but i can see the sbin folder and the mount folder but not the -uw.

    That is the problem stoping me to go further, can you please e-mail mate if its possible i got assignments to hand-it in in about 2weeks and i am stock with this problem.

    thanks, could you please e-mail me back on [email protected] it would be very kind of you my friend, thanks ones again for your video on the youtube.

  • Xac

    This is pretty amazing, thank you so much! Now I can install OSX Mavericks!

  • pk

    superb! i had trouble getting su on my osx 10.9… i am the admin…

    i tried your line: sudo passwd root.
    i input the same pass that i use as admin. so there is less chance of forgetting a password. and now, i DO have su access.

    so, that was lovely. super appreciate it! :0P

  • Anonymous

    We’re talking about Macs here, you spam-bot.

  • Jeff

    And this is why people are forced to use captcha.

  • Onur

    are you stupid or what? The product you are advertising is forWindws. The discussion here is about Mac.

  • Anonymous

    Sorry, we missed this spam the first time. Now deleted.