mac系统忘记root密码的解决办法

由于长久不用Air了,所以忘记了之前的root密码,导致很多命令都无法执行,于是找到了这个解决方法(经本人在Mac os x 10.6.8下测试成功!),故来跟大家分享下。

开机,并迅速按住 Command + S组合键,进入命令行模式
输入命令(有时可能要命令路径不同,可参考屏幕上显示的那两行提示),检查系统错误并修复
[plain] view plaincopy
/sbin/fsck -fy

输入命令,使有权限更改系统配置
[html] view plaincopy
/sbin/mount -uw /
最后根据命令
[html] view plaincopy
passwd root
来更改密码就ok啦!
然后 敲入 reboot 命令,重启机器就完工啦!


以下是原文:
Change an Admin Password in Mac OS X Single User Mode
This is a multistep process but it’s easy to follow:

First you need to enter Single User Mode. Reboot the Mac and hold down Command+S at boot to enter into the command line.
You’ll see a note where Mac OS X tells you that you need to run two commands in order to make filesystem changes, this is necessary so let’s handle that first
The first command checks the Mac OS X filesystem for errors and fixes them, it can take a few minutes to run:
fsck -fy

The next command mounts the root Mac OS X drive as writable, allowing you to make changes to the filesystem:
mount -uw /

After the filesystem is mounted, you can reset any users password using the following command:
passwd username

You’ll need to enter the new password twice to reset and confirm the changes

原文地址:https://www.cnblogs.com/ylqmf/p/2917046.html