log show 是获取 macOS 启动日志最直接权威的方式,支持查看内核初始化、驱动加载、launchd 服务启动及用户会话建立全过程;可用 --last boot 限定本次启动,--info/--debug 显示中低级别日志,配合 predicate 精准过滤内核、IO 设备或 launchd 相关事件,并支持导出文本或 JSON 格式日志。
要获取 macos 系统启动过程的详细日志,log show 是最直接、最权威的命令行方式。它对接系统统一日志(unified logging)数据库,能完整覆盖内核初始化、驱动加载、launchd 启动服务、用户会话建立等各阶段,且无需重启或进入恢复模式即可执行(只要系统已正常启动)。
这条命令拉取从开机瞬间开始的所有结构化日志,信息量大但全面:
log show --last boot --info --debug
--last boot 确保只查本次启动;--info 和 --debug 启用中低级别日志(不含 verbose),避免遗漏关键服务状态(如 Spotlight、CloudKit、WiFi 连接流程)| less 分页浏览,或用 | grep -i "start|fail|error" 快速定位异常节点启动卡在 Apple 标志、黑屏或风扇狂转时,问题往往出在底层。此时应优先检查内核和驱动日志:
log show --predicate 'subsystem == "com.apple.kernel"' --last boot
log show --predicate 'eventMessage contains "IOService" OR eventMessage contains "ACPI"' --last boot
timeout、not responding、failed to load 或重复出现的 panic 字样绝大多数“开机慢”“某功能不启动”问题源于 launchd 服务失败或延迟。用子系统过滤精准定位:
log show --predicate 'senderImagePath contains "launchd"' --last boot --info
log show --predicate 'eventMessage contains "failed to bootstrap" OR eventMessage contains "invalid property list"' --last boot
com.apple.xxx 类服务名(如 com.apple.speech.synthesisd),失败后通常伴随 Exit code: 1 或 Aborted
把原始日志保存为文本,方便反复查阅或发给工程师协助判断:
log show --last boot --info --debug > ~/Desktop/boot_log.txt
log show --last boot --level error --level fault > ~/Desktop/boot_errors.txt
log show --last boot --json > ~/Desktop/boot_log.json