macOS | nvram boot-args的作用及设置方式

本文总结如何在 macOS 上设置 boot-args 以及 boot-args 的作用。

Update: 2022 / 10 / 18



debug=0x144

参考这里 1

sudo nvram boot-args="debug=0x144"

这是内核调试功能的组合,将向您显示有关内核进程的额外信息,如果系统遇到内核崩溃,这将非常有用。

另一种选择是使用 debug=0x14e,它将显示更多的日志记录选项。这样做的主要用途是它启用旧式内核恐慌,在屏幕上显示有关系统恐慌原因的滚动文本,而不是显示灰色背景和仅重新启动系统的消息。

替代调试选项如下,尽管这些可能只对内核程序员有用:

0x01 - Stop at boot time and wait for the debugger to attach
0x02 - Send kernel debugging output to the console
0x04 - Drop into debugger on a nonmaskable interrupt
0x08 - Send kernel debugging information to a serial port
0x10 - Make ddb the default debugger
0x20 - Output diagnostics information to the system log
0x40 - Allow the debugger to ARP and route
0x80 - Support old versions of gdb on newer systems
0x100 - Disable the graphical panic dialog screen
Source: Boot argument options in OS X

ddb 只是一个调试器。一旦遇到系统问题,启用这些模式来收集信息是绝对安全的。


问题

iokit/common not permitted

当遇到如下的报错时 2

% sudo nvram boot-args="debug=0x144"
Password:
Sorry, try again.
Password:
nvram: Error setting variable - 'boot-args': (iokit/common) not permitted

因为从 macOS Sierra 开始,您必须启动到 recovery partition 才能运行 nvram 命令来正确设置 boot-args NVRAM 变量。

此外,SIP 适用于 Mac 上的所有用户,包括管理员和 root
recovery patition 下使用 csrutil disable 来禁用 SIP 将允许您在正常的启动中设置引导参数。

警告:除非确实需要,否则不应禁用 SIP


进入 recovery partition
  • 非苹果芯片 PC 3
    通过重新启动并按住 ⌘+R 进入恢复模式,直到出现 Apple 标志。
    在顶部菜单中单击实用程序 > 终端。
    在终端窗口中输入 csrutil disdable 。然后重新启动 Mac
  • 苹果芯片 PC 4
    启动 Mac 并继续按住电源按钮,直至您看到启动选项窗口。选择“选项”,然后点按“继续”。

参考链接


  1. What does "sudo nvram boot-args=“debug=0x10"” do to my Mac? ↩︎

  2. How to overcome Error Setting Variable - ‘boot-args’ : (iokit/common) not permitted ↩︎

  3. Trying to set boot-args with nvram gets “general error” on Sierra ↩︎

  4. Mac电脑进入恢复模式详细教程 ↩︎

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值