ArtsAutosBooksBusinessEducationEntertainmentFamilyFashionFoodGamesGenderHealthHolidaysHomeHubPagesPersonal FinancePetsPoliticsReligionSportsTechnologyTravel

Help! I forgot my Mac OSX Password!

Updated on August 20, 2012

Resetting or Recovering your Mas OSX Password

Yesterday, I did something stupid. I changed all my passwords to something snarky to keep my newly ex’d girlfriend from logging into my accounts and… promptly forgot my own snarkiness the next day: I was locked out of my desktop MacPro computer.

I had two options: I could simply change the admin password in about 2 minutes, or I could recover the password I had actually created so that I could use it for all my other accounts that I had also changed.

If you own a Mac 10.4+ (Tiger, Leopard and Snow Leopard), merely changing your admin password is easy.

Option 1: Changing your Mac computer’s admin password when you’re locked out:

(1) Restart your Mac and press CMD + s as it’s booting up. This gets you into Single User Mode. If you did this correctly, you’ll see a black screen with a bunch of text.

(2) At the prompt, type fsck –fy

(3) Type mount -uw /

(4) Type launchctl load /System/Library/LaunchDaemons/

(5) If you don’t know the short form of your admin username, type ls /Users (list everything in the Users directory) and this will give you a list of all user shortnames.

(6) Type dscl . -passwd /Users/UserName newpassword (replace UserName with the short form of your admin username and change newpassword with your new password).

Now, in my instance, I had changed everything with my snarky bad temper including some accounts that didn’t have password recovery features: I needed to recover the password, not just change it.

This is a lot more complicated and time consuming. Get a pen and paper. You’re going to need it.

Option 2: Recovering your Mac Password without changing it

(1) Restart the target computer while pressing CMD + s to go into Single User Mode.

(2) If you’re using Mac OS 10.4 (Tiger), you need to type the following at the command prompt:

niutil –readprop ./users/<username> generateduid

If you’re on Mac OS 10.5 or higher (leopard and snow leopard), however, do NOT type the above command, but rather the following:

dscl localhost -read /Search/Users/<username> | grep GeneratedUID | cut -c15-

This will return a long string of random letters and numbers separated by dashes. This is your GUID and you need to write down: You’ll need it in a later step.

(3) Type cat /var/db/shadow/hash/<TheGUID> replacing <TheGUID> with the string you copied down from Step 2, above. This will return a different, very long string of numbers without hyphens. Copy this second hash the way you did with the GUID. You’ll need it.

(4) At this point, you can choose to do the rest of the steps on another computer, altogether. If you don’t have access to about a day or more of access to another computer, you can use your target by creating a new admin using the instructions, below. In any case, you’re going to be doing a brute force decryption using an application called John The Ripper, which you can download, here:

(5) For ease of use, after unzipping John The Ripper, I moved the extracted folder to the root. In any case, copy the hash from step 3, above, to a text file in the following format:

username:<hash> replacing <hash> with the long string you copied in Step 3.

(6) Save it in the extracted John folder as sha1.txt in the extracted folder.

(7) In Terminal, type: ./john sha1.txt and, depending on how complex your password is, you should see the result in anywhere from minutes to a couple of days. It’s probably the one time when you probably wish you didn’t have a long, complex password.

Creating a temporary Admin when you’re locked out of your Mac OS 10.4 – 10.6.x

Sometimes, it’s necessary to create a new admin from Single User Mode and if you’re trying to hack your own password, it may be that the computer you’re trying to hack is the one you have long term access to.

No problem! Creating a new admin when you’re locked out of your Mac OS X computer takes about a minute. Here’s how it’s done:

(1) Restart your computer and hold down the CMD + s buttons as it’s rebooting. You should get a black screen with a bunch of white text.

(2) Type: fsck –fy

(3) Type: mount -uw /

(4) Type: rm /var/db/.applesetupdone

(5) Type: reboot

Your computer will shut down. When you restart it, you’ll need to go through the whole video thing as you did when you first bought your Mac. Set your language, etc. and make sure you don’t choose migrating information. When you have the option to create a new user account, make sure you do not name it the same as the account you’re trying to recover.

Viola! New admin account! Now you can use John the Ripper to brute force your password hash.

Good Luck.


    0 of 8192 characters used
    Post Comment

    • Matt Hatter profile imageAUTHOR

      Sean Rice 

      4 years ago from Boston, MA

      @Brian: The instructions I wrote were for Mac OS up to Snow Leopard. It's possible that directory names may have changed and even that it's completely obsolete on your much newer Mac. Try looking around the web for a set of instructions that answer to your particular Mac OS.

    • profile image


      4 years ago

      Hi Matt,

      Everything worked perfectly until I re-entered the GUID. I am getting the message: "No such file or directory" (OS 10.9). Very positive I am inputting the GUID correctly. Any thoughts?

    • Matt Hatter profile imageAUTHOR

      Sean Rice 

      5 years ago from Boston, MA


      What Version of Mac OS are you using and which step are you following ("however when I enter Is /Users"). Remember that things are case sensitive and spaces and punctuation is important.

    • profile image


      5 years ago

      Hi :) I've tried doing the first way of changing my password, however when I enter Is /Users it says command not found? I'm pretty sure that I've done everything right up to that step...

      Thank you :)

    • Matt Hatter profile imageAUTHOR

      Sean Rice 

      5 years ago from Boston, MA

      I am unable to duplicate the issue when I follow my own instructions. However, is there a reason for the space after cat /var/db/shadow/hash/ ?

    • profile image


      5 years ago

      Hi! Thanks for the useful guide, but every time I input:

      cat /var/db/shadow/hash/ 094385CA-5D95-4123-A898-7DD12A278878 (this is my uid) it says

      -sh: syntax error near unexpected token `newline'


    This website uses cookies

    As a user in the EEA, your approval is needed on a few things. To provide a better website experience, uses cookies (and other similar technologies) and may collect, process, and share personal data. Please choose which areas of our service you consent to our doing so.

    For more information on managing or withdrawing consents and how we handle data, visit our Privacy Policy at:

    Show Details
    HubPages Device IDThis is used to identify particular browsers or devices when the access the service, and is used for security reasons.
    LoginThis is necessary to sign in to the HubPages Service.
    Google RecaptchaThis is used to prevent bots and spam. (Privacy Policy)
    AkismetThis is used to detect comment spam. (Privacy Policy)
    HubPages Google AnalyticsThis is used to provide data on traffic to our website, all personally identifyable data is anonymized. (Privacy Policy)
    HubPages Traffic PixelThis is used to collect data on traffic to articles and other pages on our site. Unless you are signed in to a HubPages account, all personally identifiable information is anonymized.
    Amazon Web ServicesThis is a cloud services platform that we used to host our service. (Privacy Policy)
    CloudflareThis is a cloud CDN service that we use to efficiently deliver files required for our service to operate such as javascript, cascading style sheets, images, and videos. (Privacy Policy)
    Google Hosted LibrariesJavascript software libraries such as jQuery are loaded at endpoints on the or domains, for performance and efficiency reasons. (Privacy Policy)
    Google Custom SearchThis is feature allows you to search the site. (Privacy Policy)
    Google MapsSome articles have Google Maps embedded in them. (Privacy Policy)
    Google ChartsThis is used to display charts and graphs on articles and the author center. (Privacy Policy)
    Google AdSense Host APIThis service allows you to sign up for or associate a Google AdSense account with HubPages, so that you can earn money from ads on your articles. No data is shared unless you engage with this feature. (Privacy Policy)
    Google YouTubeSome articles have YouTube videos embedded in them. (Privacy Policy)
    VimeoSome articles have Vimeo videos embedded in them. (Privacy Policy)
    PaypalThis is used for a registered author who enrolls in the HubPages Earnings program and requests to be paid via PayPal. No data is shared with Paypal unless you engage with this feature. (Privacy Policy)
    Facebook LoginYou can use this to streamline signing up for, or signing in to your Hubpages account. No data is shared with Facebook unless you engage with this feature. (Privacy Policy)
    MavenThis supports the Maven widget and search functionality. (Privacy Policy)
    Google AdSenseThis is an ad network. (Privacy Policy)
    Google DoubleClickGoogle provides ad serving technology and runs an ad network. (Privacy Policy)
    Index ExchangeThis is an ad network. (Privacy Policy)
    SovrnThis is an ad network. (Privacy Policy)
    Facebook AdsThis is an ad network. (Privacy Policy)
    Amazon Unified Ad MarketplaceThis is an ad network. (Privacy Policy)
    AppNexusThis is an ad network. (Privacy Policy)
    OpenxThis is an ad network. (Privacy Policy)
    Rubicon ProjectThis is an ad network. (Privacy Policy)
    TripleLiftThis is an ad network. (Privacy Policy)
    Say MediaWe partner with Say Media to deliver ad campaigns on our sites. (Privacy Policy)
    Remarketing PixelsWe may use remarketing pixels from advertising networks such as Google AdWords, Bing Ads, and Facebook in order to advertise the HubPages Service to people that have visited our sites.
    Conversion Tracking PixelsWe may use conversion tracking pixels from advertising networks such as Google AdWords, Bing Ads, and Facebook in order to identify when an advertisement has successfully resulted in the desired action, such as signing up for the HubPages Service or publishing an article on the HubPages Service.
    Author Google AnalyticsThis is used to provide traffic data and reports to the authors of articles on the HubPages Service. (Privacy Policy)
    ComscoreComScore is a media measurement and analytics company providing marketing data and analytics to enterprises, media and advertising agencies, and publishers. Non-consent will result in ComScore only processing obfuscated personal data. (Privacy Policy)
    Amazon Tracking PixelSome articles display amazon products as part of the Amazon Affiliate program, this pixel provides traffic statistics for those products (Privacy Policy)