24

My sister bought a used MacBook about 6 months ago and she has lost her password.

Here is the procedure I tried to use to reset the password:

  1. Boot into single user mode (press Command-S at power on)
  2. Type fsck -fy
  3. Type mount -uw /
  4. Type launchctl load /System/Library/LaunchDaemons/com.apple.DirectoryServices.plist
  5. Type dscl . -passwd /Users/username password, replacing username with the targeted user and password with the desired password.
  6. Reboot

But when I try the step 4, it says launch_msg(): Socket is not connected.

I would like to know what command to enter in the single user mode to know what version the Macbook is running and the right command to reset the password. Thank you.

2
  • In your forth step "dscl . passwd /Users/username" is the "passed" the new password? And is the "username" the username found in command "ls /User"?
    – user53018
    Jul 10, 2013 at 17:11
  • I am going to close this to the canonical question that clearly answers this for macOS Catalina - the accepted answer here is outdated and the linked question will be far more useful to most people with this issue. Please raise a question on Ask Different Meta if needed to revise this close or migrate answers or lock this post.
    – bmike
    Apr 25, 2020 at 17:13

4 Answers 4

4

Once you mount the file system, you should be able to use passwd username and then put in the password twice.

7
  • You recommand those steps : 1. Type fsck -fy 2. Type mount -uw / 3. Type passwd username Is there a way to know the user name ? I'm not sure if I should enter the space from the main screen name...
    – Alexandre
    Aug 24, 2012 at 17:06
  • If I remember right I tried that also yesterday and the system was asking me to enter launchctl load /System/Library/LaunchDaemons/com.apple.DirectoryServices.plist first :(
    – Alexandre
    Aug 24, 2012 at 17:08
  • You can do an ls /Users/ and view the users list there.
    – hiiambo
    Aug 24, 2012 at 17:14
  • Thanks a lot ! I was typing Is* instead of ls. (*Capital i)
    – Alexandre
    Aug 24, 2012 at 17:29
  • 1
    It's an l so it'd be LS if in all caps
    – hiiambo
    Aug 24, 2012 at 18:11
52

Try loading com.apple.opendirectoryd.plist instead.

  1. Hold command-S on startup.
  2. Run mount -uw /. (fsck -fy is not necessary.)
  3. In 10.7 and later, run:

     launchctl load /System/Library/LaunchDaemons/com.apple.opendirectoryd.plist
    

    or in 10.6 and earlier:

    launchctl load /System/Library/LaunchDaemons/com.apple.DirectoryServices.plist
    
  4. Run passwd username and reset the password.
  5. Run reboot.

A second way to reset the login password of an account is to use Reset Password.app from the recovery partition:

  1. Hold command-R on startup.
  2. Open Terminal from the Utilities menu.
  3. Run resetpassword, which opens the Reset Password application.
  4. Select the volume and account and reset the password.

A third way is to create a new admin account:

  1. Hold command-S on startup.
  2. Run mount -uw /.
  3. Run rm /var/db/.AppleSetupDone.
  4. Run reboot.
  5. Go through the steps of creating a new account.
  6. Reset the password of the old account from the Users & Groups preference pane.

None of these options resets the password of the login keychain.

If FileVault 2 is enabled, you have to enter a password to start up in single user mode, and you can't use Reset Password.app to reset the password of an account.

5
  • Alas none of this worked in my situation. I just keep getting 'launch_msg(): Socket is not connected'.
    – Dave Sag
    Aug 21, 2013 at 1:06
  • Any reason that com.apple.opendirectoryd.plist would not exist? Oct 1, 2013 at 21:55
  • /System/Library/LaunchDaemons/com.apple.DirectoryServices.plist doesn't exist in OSX 10.4 on my Powerbook G4. Just gonna point that out.
    – Wyatt Ward
    Nov 18, 2016 at 21:34
  • Perfect, thorough answer. Thanks so much for this. Quick question: can you expand on the consequences of the "login keychain" not being reset with this? Thanks! Jan 6, 2017 at 15:18
  • The third way worked for me with Snow Leopard Server; the first and second did not. Nov 18, 2017 at 20:42
7

I kept getting the launch_msg(): Socket is not connected message, so I used cd to get to the LaunchDaemons directory and typed in

launchctl load com.apple.DirectoryServices.plist 
passwd username

This worked. Not sure why it didn't like the directory path as it had no errors.

3
  • This answer has already been given.
    – grg
    Mar 2, 2014 at 15:38
  • 1
    The answer was not given because everybody was trying to type in launchctl load /System/Library/LaunchDaemons/com.apple.opendirectoryd.plist. This did not work as I had to go to the LaunchDaemons directory.
    – Kelli
    Mar 2, 2014 at 15:49
  • 2
    This worked for me too, after I did the following: after you cd into the LaunchDaemons directory at /System/Library that you type the command mount -uw / in order to make your commands writable Nov 23, 2015 at 23:40
2

Hold ⌘-S on startup, then type

/sbin/fsck -y
/sbin/mount -uw /
sh /etc/rc

passwd [username of account you want to change here]

It should ask you to enter the new password twice.

reboot

Not the answer you're looking for? Browse other questions tagged .