用 system_profiler 获取指定硬件报告
只打印需要的硬件部分——序列号、电池、存储、网络——支持文本或 JSON 输出。
运行 `system_profiler SPHardwareDataType` 查看机器概要,加 `-json` 即可输出脚本友好的 JSON。
01命令
命令
$ system_profiler SPHardwareDataType02作用说明
system_profiler 是系统信息 App 背后的引擎,每个 DataType 参数打印一个部分:SPHardwareDataType(机型、序列号、芯片)、SPPowerDataType(电池)、SPStorageDataType、SPNetworkDataType 等数十种。`system_profiler -listDataTypes` 可列出全部类型,`-json` 让输出能直接用 jq 解析。完整报告很耗时,请始终指定具体的数据类型而不是裸跑。
03风险
04撤销
✓无需撤销——该命令不会改变持久状态。
05来源
- SYSTEM_PROFILER Command: Report macOS system hardware and software configuration依据: Documents system_profiler data types, -json output, and -detailLevel for targeted hardware reports.
最后验证: 2026-09-17 · 分类: 系统与设置