I m trying to identify if my launched process is running on a local mac machine(desktop/laptop) or a virtual macOS X instance like AWS EC2, Azure, MacStadium etc.
I have followed this link which searched for its limited providers in the output, but I m not bound to any limited providers and looking for a general solution which is applicable to all the providers.
Is there some hardware/network/virtualization-related information that can be used to identify if the process is launched on a virtual MacOS instance?
OR is there some system Information that I can use to be sure that my process is running on a local machine?
This works in all the VM environments I use day-to-day:
-
VMware Fusion:
% sysctl kern.hv_vmm_present kern.hv_vmm_present: 1
-
QEMU:
% sysctl kern.hv_vmm_present kern.hv_vmm_present: 1
-
Virtualization framework:
% sysctl kern.hv_vmm_present kern.hv_vmm_present: 1
If it’s not working for a specific virtual machine platform, I recommend that you raise that with the platform vendor.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"