
OSX Lion
# /sbin/fsck -fy # /sbin/mount -uw / # launchctl load /System/Library/LaunchDaemons/com.apple.opendirectoryd.plist # passwd root # exit |
Mac OS X Tiger – Snow Leopard
# /sbin/fsck -fy # /sbin/mount -uw / # launchctl load /System/Library/LaunchDaemons/com.apple.DirectoryServices.plist # dscl . > passwd root > exit # exit |
Many people have been wondering what would happen if they forgot their admin password in Mac OS X. There is a solution: you have to own a Mac OS X Install DVD which provides a Password Utility application. But what if you don’t have one? There is a solution.
Important Note: This works only if there is no Firmware Password set. Firmware Password blocks the ability to boot your computer in single-user mode.
All you have to do is turn on your computer holding CMD + S
. This will boot your Mac in Single-User Mode. Next, you have to wait a second while kernel will load command-line interface. It there is :/ root#
line, you’re ready to go!
OSX Lion
First of all, type
# /sbin/fsck -fy |
This will take a while. It will check the consistency of your filesystem. If there is no error, your output should be similar to this:
** /dev/rdisk0s2 ** Root file system Executing fsck_hfs (version diskdev_cdms-491.6~1). ** Checking Journaled HFS Plus volume. ** Ckeching extents overflow file. ** Checking catalog file. ** Checking multi-linked files. ** Checking catalog hierarchy. ** Checking extended attributes file. ** Checking multi-linked directories. ** Checking volume bitmap. ** Checking volume information. ** The volume Macintosh HD appears to be OK. :/ root# |
The last three steps are very quick:
# /sbin/mount -uw / # launchctl load /System/Library/LaunchDaemons/com.apple.opendirectoryd.plist # passwd root |
Bash will ask you for the new password for your root account. Type, retype and done! You can now safely type
# exit |
and your Mac will display the Login Screen.
Max OS X Tiger – Snow Leopard
For older operation system this process looks a little bit different. First of all, type these standard commands:
# /sbin/fsck -fy # /sbin/mount -uw / |
And here is the difference: the LaunchDaemon plist is located elsewhere.
# launchctl load /System/Library/LaunchDaemons/com.apple.DirectoryServices.plist |
In Snow Leopard you have to add this line too:
# dscl . |
Now, type this and change your root password.
> passwd root |
Note: You have to type exit
twice in this case.