重置Macos密碼

Recovery Mode

In Lion and Mountain Lion you can use Recovery Mode to reset the password.  Just restart the computer and hold down Command + r until the menu screen appears.  Click Terminal from the Utilities Menu and enter this:

resetpassword

 

Single User Mode

The other option is to delete the Apple Setup file to trick the Mac into thinking it just came off the truck from the factory.

After deleting the Setup File and rebooting, you’ll see a “Welcome to Mac OS X” setup screen which will walk you through the process of creating a new admin account.

To make it happen, we have to boot into something known as Single User Mode.  This is a limited environment with no graphical user interface but is very helpful when you need to perform advanced troubleshooting.

That’s what we’re going to do today.

Reboot the Mac and hold down Command + s to enter Single User mode.  Keep holding down Command + s until you see a black screen with white text.

The command prompt is that right rectangle near the bottom of the screen.  This is what it looks like on my Macbook Air:

fixedbyvonnie-mac-os-x-single-user-mode.jpguploading.4e448015.gif轉存失敗重新上傳取消Mac OS X Single User Mode

At the command prompt enter this:

mount -uw /

This mounts the root file system (the forward slash /) and tells the computer to change the status of any already mounted file systems (that’s the -u part of the command) and make sure it’s read-write (the w in the command).

Press enter to move to the next line and type this:

rm /var/db/.AppleSetupDone

This looks a little more cryptic than the mount command but it’s not too hard to decipher if you break it into groups.

The rm part removes directories.  In this case, it’s removing a directory that lives in a /var/db/ called .AppleSetupDone

Deleting this folder is the trick that forces the Mac to think it has a new lease on life.

Press enter to move to the next line and finish up with this command:

shutdown -h now

The dash h halts the Mac at a specified time, in this case we’re saying, “Shutdown Now

 

 

http://www.fixedbyvonnie.com/2013/09/how-to-reset-the-admin-password-on-your-mac-without-a-disk/

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章