如何检测 Mac OS X 是否在虚拟 Machine 中 运行

How to detect if Mac OS X is being run inside a Virtual Machine

我不希望我的应用 运行 在 Mac 上的虚拟机中。如何从我的 Mac 应用中检测到它。 Windows 和 Linux 的解决方案非常简单,并在其他类似问题中进行了详细讨论。我不介意执行

system_profilerioreg

一探究竟。但是要寻找什么?我的目标是 Parallels、VMware Fusion 和 Virtual Box

在以下命令的输出中搜索 VirtualBoxOracleVMwareParallels 效果很好:

ioreg -l | grep -e Manufacturer -e 'Vendor Name'