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.

91 Responses to “Mac OS X Recover Lost Root Password”

  1. October 16, 2008 at 4:45 am, thomas bowen said:

    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

    Reply

    • August 11, 2012 at 3:30 am, Patrick J said:

      > 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.

      Reply

  2. October 29, 2008 at 8:00 am, jason myers said:

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

    Reply

  3. November 25, 2008 at 4:47 am, Nikki G. said:

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

    Reply

    • September 13, 2012 at 6:21 pm, krikor said:

      > forgot my password to myMAC DO X any help?

      Reply

  4. November 27, 2008 at 11:01 am, kathy said:

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

    Reply

  5. November 28, 2008 at 11:23 pm, les said:

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

    Reply

  6. December 10, 2008 at 4:32 am, jB said:

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

    Reply

    • January 02, 2009 at 2:46 pm, Ad said:

      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

      Reply

  7. January 07, 2009 at 12:28 am, Manda said:

    Will this work with filevault active?

    Reply

  8. January 13, 2009 at 4:32 am, rex2930 said:

    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

    Reply

  9. January 13, 2009 at 4:56 am, rex2930 said:

    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

    Reply

  10. January 29, 2009 at 6:19 pm, keef said:

    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… ???

    Reply

  11. February 28, 2009 at 6:00 pm, Mohit said:

    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

    Reply

  12. March 09, 2009 at 7:10 am, Anonymous said:

    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?

    Reply

  13. April 23, 2009 at 1:58 pm, Matt said:

    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?

    Reply

  14. May 07, 2009 at 7:34 pm, Erkan said:

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

    Reply

  15. May 14, 2009 at 6:18 pm, thomas said:

    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

    Reply

  16. June 21, 2009 at 1:57 pm, Joe T Lor said:

    I can not start my G4 lost the password OS

    Reply

    • July 04, 2009 at 6:28 am, Shiv said:

      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.

      Reply

  17. July 15, 2009 at 12:15 am, in2town said:

    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

    Reply

  18. July 20, 2009 at 5:35 pm, SK said:

    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.

    Reply

  19. July 25, 2009 at 2:27 am, carlos said:

    where do i type that? whats the sudo comand?

    Reply

  20. August 12, 2009 at 9:21 pm, Anonymous said:

    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.

    Reply

  21. August 13, 2009 at 7:09 am, Anonymous said:

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

    Reply

  22. August 28, 2009 at 1:04 am, George said:

    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

    Reply

  23. September 12, 2009 at 4:09 pm, Anonymous said:

    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.

    Reply

    • September 17, 2009 at 10:36 pm, Anonymous said:

      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

      Reply

  24. September 19, 2009 at 11:37 pm, Anonymous said:

    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.

    Reply

  25. November 11, 2009 at 2:57 am, Mike said:

    Worked like a charm! Thanks!

    Reply

  26. November 21, 2009 at 12:54 am, Anonymous said:

    IT WORKED
    U THE MAN

    Reply

  27. November 26, 2009 at 2:05 pm, Anonymous said:

    hm…interesting…

    Reply

  28. December 14, 2009 at 1:41 am, Joel Garfield said:

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

    Reply

  29. December 23, 2009 at 9:12 pm, zadova said:

    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.

    Reply

  30. December 26, 2009 at 1:34 am, Nelly said:

    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..

    Reply

  31. December 31, 2009 at 2:31 pm, Anonymous said:

    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!

    Reply

  32. January 01, 2010 at 10:52 pm, Anonymous said:

    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?

    Reply

  33. January 04, 2010 at 11:49 am, Anonymous said:

    hello

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

    thanks

    Reply

  34. January 10, 2010 at 12:56 pm, Anonymous said:

    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

    Reply

  35. February 18, 2010 at 3:11 am, Anonymous said:

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

    Reply

    • April 07, 2010 at 4:54 am, Jeff said:

      Your original account is an administrator account. If you have your install disc there’s a reset password option. See here: http://support.apple.com/kb/ht1274

      Reply

  36. March 09, 2010 at 1:30 am, Anonymous said:

    Thank you so much , i recovered my root password.

    Reply

  37. May 10, 2010 at 1:40 pm, Anonymous said:

    What if I do not have the install CD?

    Reply

  38. May 25, 2010 at 6:06 am, Anonymous said:

    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.

    Reply

    • June 08, 2010 at 1:35 pm, Anonymous said:

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

      Reply

    • September 02, 2010 at 10:32 am, unclenice said:

      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.

      Reply

  39. June 20, 2010 at 5:59 pm, Prodigal_1 said:

    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!

    Reply

  40. July 10, 2010 at 5:40 am, Bryancommeaux said:

    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.

    Reply

  41. July 28, 2010 at 9:13 pm, Mcdojan said:

    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.

    Reply

  42. July 29, 2010 at 6:12 pm, Sharonte_r said:

    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?

    Reply

  43. August 17, 2010 at 5:09 am, Laurel 1234 said:

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

    Reply

  44. August 25, 2010 at 3:08 am, Anonymous said:

    you can try to google Password Genius

    Reply

  45. September 03, 2010 at 9:34 am, Anonymous said:

    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.

    Reply

  46. September 09, 2010 at 6:52 pm, aroo-roo-roo said:

    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?

    Reply

  47. September 11, 2010 at 10:24 am, Bollywood21m said:

    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.

    Reply

  48. September 13, 2010 at 12:53 pm, Joseamedina10 said:

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

    Reply

  49. September 21, 2010 at 7:30 pm, sm535 said:

    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?

    Reply

  50. October 06, 2010 at 9:00 am, Homas45 said:

    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

    Reply

  51. October 18, 2010 at 8:49 pm, Alexa44 said:

    Thank you so much

    Reply

  52. October 24, 2010 at 9:40 am, Mrtauch779 said:

    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.

    Reply

  53. December 19, 2010 at 1:12 am, mjdl23 said:

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

    Reply

  54. January 09, 2011 at 2:27 am, Mannyceo13b said:

    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

    Reply

  55. January 18, 2011 at 8:35 am, Nathan Brown said:

    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

    Reply

    • March 13, 2011 at 4:28 am, Michael said:

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

      Reply

  56. March 26, 2011 at 8:04 pm, Aaron Wilson said:

    worked like a charm, thanks.

    Reply

  57. May 15, 2011 at 9:31 am, Norberto M. Tiongson said:

    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

    Reply

  58. May 15, 2011 at 1:54 pm, Romi Savini said:

     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

    Reply

  59. May 23, 2011 at 1:19 pm, Giada Condor said:

    Do not waste
    time ..
    to find
    all types
    of passwords (except myspace) please
    contact me, but
    only if
    it comes to
    good causes! giada.condor@hotmail.it
     

    Reply

  60. June 23, 2011 at 10:16 pm, Sarrithkumar said:

    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…

    Reply

  61. August 08, 2011 at 12:14 am, Phil said:

    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!!

    Reply

  62. November 05, 2011 at 4:54 pm, pumpkin said:

    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?

    Reply

  63. November 12, 2011 at 7:50 am, Christopher Levins said:

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

    Reply

  64. March 06, 2012 at 9:51 pm, Stephanie said:

    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.

    Reply

  65. March 30, 2012 at 10:21 am, Hemant Jadhav said:

    Worked well on MACOS 10.6.8
    Thanks

    Reply

  66. June 24, 2012 at 1:32 am, vbg said:

    Thanks – it worked word to word – great help

    Reply

  67. July 28, 2012 at 5:18 pm, Nageswara Rao Bitra said:

    thanks a lot!! it really helped me.

    Reply

  68. August 01, 2012 at 8:20 am, padma said:

    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.

    Reply

  69. November 17, 2012 at 3:06 pm, Runcy said:

    Awesome! This worked like a charm

    Reply

  70. November 21, 2012 at 5:04 pm, Carl Wainwright said:

    Thanks – Resolved my issue…

    Reply

  71. December 20, 2012 at 7:21 pm, Jed said:

    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

    Reply

    • December 26, 2012 at 8:49 pm, alain said:

      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

      Reply

    • December 26, 2012 at 8:49 pm, alain said:

      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

      Reply

  72. December 24, 2012 at 4:44 pm, asad said:

    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 asadhafizi9@hotmail.com it would be very kind of you my friend, thanks ones again for your video on the youtube.

    Reply

  73. November 08, 2013 at 6:13 am, Xac said:

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

    Reply

  74. February 09, 2014 at 2:53 am, pk said:

    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

    Reply

  75. January 22, 2010 at 8:10 pm, Anonymous said:

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

    Reply

  76. April 07, 2010 at 4:52 am, Jeff said:

    And this is why people are forced to use captcha.

    Reply

  77. December 14, 2010 at 10:40 am, Onur said:

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

    Reply

  78. December 14, 2010 at 2:15 pm, Anonymous said:

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

    Reply

Leave a Reply