Hello everyone, this tutorial shows how to change the admin password on a mac with command line without knowing the actual password!:
There’s 2 possibilities depending on your mac system version:
Shutdown your computer. (Turn it right off – do not restart.)
Use your left hand to hold down the ‘Apple’ or ‘Command’ key on the keyboard (directly beside the space bar) and the letter ‘S’ . Hold both of these together and do not let go through the next step.
Turn the computer on, ensuring that you are still holding the ‘Command’ and ‘S’ keys.
Wait until you see a bunch of white writing scrolling by on a black screen. You can release the keys, and you are now in Single-User mode. The computer is ready to continue when you see localhost:/ root# or something similar as the very last line on the screen.
Image titled Reset a Lost Admin Password on Mac OS X Step 42
Check the drive for errors. Next we want to check the drive for errors (and fix them if there are any). We do this because of the power of Single-User Mode, we do not want to be making massive changes to the file-system if there are underlying issues which could be made worse. Right after the # on the last line of the screen type fsck -fy and press [Return] when the process is finished (approximately two to three minutes) you will see localhost:/ root# (henceforth referred to as the prompt) again.
Image titled Reset a Lost Admin Password on Mac OS X Step 5
Access the drive so that we can make changes. Before you can reset your password you need to mount the drive; this will allow you to make changes to files. At the prompt type mount -uw / and press [Return].
Image titled Reset a Lost Admin Password on Mac OS X Step 64
Reset the password.
Type launchctl load /System/Library/LaunchDaemons/com.apple.opendirectoryd.plist and press [Return].
Type ls /Users and press [Return]. A list of all of the accounts on your computer will be listed along with ‘Public’
Type dscl . passwd /Users/username password while replacing username with one of the users displayed in the previous step and replacing password with the new password of your choice. Press [Return]. Ignore error message appearing after entering this command.
Image titled Reset a Lost Admin Password on Mac OS X Step 75
Restart the computer and try the new password. At the prompt type reboot [Return]. The computer will restart and you will now be able to use your new password.
Do the same steps unit the command line screen shows up, then:
type in :
mount -uw / ( press enter )
rm /var/db/.AppleSetupDone ( press enter )
shutdown -h now ( press enter )
create new user after device reboots
go to the preferences>Users>select “the_real_computer_admin_name”>change password>put in the password>done
reboot and login with new password of the admin user and delete the recently created user by going again to the users menu and select the created user and use the “-” button to delete it so your computer is like in it’s first use state!
Hope you enjoyed!!!