macosx/Sierra:获得对 /System/Library/CoreServices 的写入权限

macosx/Sierra: getting write permissions on /System/Library/CoreServices

我正在使用 macosx/Sierra,我想获得对 /System/Library/CoreServices 文件夹的写入权限。我通过sudo将自己设置为root,树中的所有目录都有drwxr-xr-x权限,但我仍然无法在该目录中写入。

% sudo -s
# cd /System/Library/CoreServices
# pwd
/System/Library/CoreServices
# whoami
root
# ls -ld .
0 drwxr-xr-x  160 root  wheel  5440 Feb 14 10:00 ./
# touch x
touch: x: Operation not permitted

有什么方法可以启用此目录的写入权限为 root

提前致谢。

macOS Sierra (a.k.a.10.12) 引入了系统完整性保护。这使得大量的启动文件系统(主要是 /System/...)不可变。有没有root权限都没有关系。

有几种方法可以解决这个问题。

  • 从不同的启动卷启动; SIP只保护电流 启动音量。
  • 使用 csrutil 工具关闭 SIP

请注意,您仍然需要从不同的启动卷启动以禁用 SIP,因为 csrutil 无法为启动卷关闭它。 (提示:启动到恢复卷是完成此操作的快速方法。)但就个人而言,我不推荐它。

Is there any way I can enable write access on this directory as root?

不,除非你像 James Bucanek 提到的那样禁用 SIP,但我不推荐这样做。

有关该主题的 Apple [支持文档] 中可以找到更多信息。(https://support.apple.com/ro-ro/HT204899)