If you try to run QEMU under macOS Big Mac Sur with the -machine accel=hvf
flag (basically with Apple’s Hypervisor Framework) you’ll get one ugly error; every time hv_vm_create()
runs it returns an HV_ERROR
. The reason is that the com.apple.vm.hypervisor
entitlement (used in macOS 10.15) has been deprecated and replaced by com.apple.security.hypervisor
.
You need to sign your binary with the correct entitlement. Add the XML below to an entitlements.xml
file.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.hypervisor</key>
<true/>
</dict>
</plist>
After that, sign the QEMU binary with the entitlements.xml
file.
$ codesign -s - --entitlements entitlements.xml --force /usr/local/bin/qemu-system-x86_64
Starting QEMU with -machine accel=hvf
will work now.