How can I reset a Mac's password from Single User Mode? 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:


Boot into single user mode (press Command-S at power on)
Type fsck -fy
Type mount -uw /
Type launchctl load /System/Library/LaunchDaemons/com.apple.DirectoryServices.plist
Type dscl . -passwd /Users/username password, replacing username with the targeted user and password with the desired password.
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.
Try loading com.apple.opendirectoryd.plist instead.


Hold command-S on startup.
Run mount -uw /. (fsck -fy is not necessary.)
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

Run passwd username and reset the password.
Run reboot.


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


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


A third way is to create a new admin account:


Hold command-S on startup.
Run mount -uw /.
Run rm /var/db/.AppleSetupDone.
Run reboot.
Go through the steps of creating a new account.
Reset the password of the old account from the Users &amp; 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.