小工具知识网

当前位置: 首页 > 行业知识 > Mac OSX使用 sudo 甚至直接使用 root 账号操作仍提示无权限

行业知识

Mac OSX使用 sudo 甚至直接使用 root 账号操作仍提示无权限

2026-11-02 12:49:48 来源:互联网转载

在 Mac 上, 通�� root 权限去执行命令时, 仍然提示 “Operation not permitted” ,或者去编辑文件时仍然提示 “E45: ‘readonly’ option is set (add ! to override)” , 这是新版本的 Mac OSX 系统增加了 SIP(System Integrity Protection) 特性导致的。SIP 特性顾名思义就是对操作系统完整性的保护。

可以在终端运行 “crsutil status” 命令来查看 SIP 特性是何种状态 :

[yihuaiyuan@/]$ csrutil statusSystem Integrity Protection status: enabled.

如果是 enabled 状态,表示开启 SIP 特性,默认是开启的。 可以通过 “crsutil disable” 命令关闭:

[yihuaiyuan@/]$ csrutil disablecsrutil: failed to modify system integrity configuration. This tool needs to be executed from the Recovery OS.

根据提示可知,“csrutil disable” 命令不能直接被执行, 只能在 Recovery OS 状态下执行.

接下来重启电脑, 按住 “Command + R” 进入Recovery OS ,然后找到 “实用工具->终端” , 打开终端执行此命令。

执行成功会返回 Successfully,并提示需要重启电脑生效

-bash-3.2# csrutilusage: csrutil Modify the System Integrity Protection configuration. All configuration changes apply to the entire machine.Available commands:    clear        Clear the existing configuration.    disable        Disable the protection on the machine. Only available in Recovery OS.    enable        Enable the protection on the machine. Only available in Recovery OS.    status        Display the current configuration.    netboot        add             Insert a new IPv4 address in the list of allowed NetBoot sources.        list            Print the list of allowed NetBoot sources.        remove             Remove an IPv4 address from the list of allowed NetBoot sources.            -bash-3.2# crsutil disableSuccessfully disabled System Integrity Protection. Please restart the machine for the changes to take effect.-bash-3.2# 

重启之后再查看 SIP 状态已关闭:

[yihuaiyuan@/]$ csrutil statusSystem Integrity Protection status: disabled.

之前没有权限的操作就可以操作了, 为了避免以后手抖误操作破坏系统, 可以在本次执行完之后再通过上述方法开启 SIP 。

上一篇:QQ密码设置教程,轻松掌握设置密码的步骤与技巧!

下一篇:幻梦斗罗服务器怎么进入?