用 system_profiler 输出 USB 设备树
可脚本化的"系统信息":每个 USB 设备、集线器、速率与供电情况,全部 JSON 输出。
运行 `system_profiler SPUSBDataType` 得到可读的设备树,加 `-json` 即可交给 jq 做脚本处理。
01命令
命令
$ system_profiler SPUSBDataType -json | jq02作用说明
system_profiler 为每个硬件领域都提供专属数据类型:SPUSBDataType、SPThunderboltDataType、SPNVMeDataType、SPAudioDataType 等。JSON 输出包含产品 ID、协商速率以及每个端口提供的电流——排查"硬盘识别不出来"时特别有用。只需要名称时加 -detailLevel mini 提速,也可以一次查询多项:`system_profiler SPUSBDataType SPAudioDataType`。
03风险
04撤销
✓无需撤销——该命令不会改变持久状态。
05来源
- macOS system_profiler — report system hardware and software configuration依据: Documents system_profiler's SP*DataType reports and the -json/-detailLevel options.
最后验证: 2026-09-17 · 分类: 系统与设置