macOS on Windows with QEMU

It is possible to emulate macOS inside Windows with Qemu. There are a number of difficulties with keyboards, mouse and drivers, but below is a command line that has been verified working with Monterey and WHPX accelerator.

This is useful for testing features and obtaining screenshots, but will not be a reliable system due to continuous updates to Qemu and macOS.

Start by obtaining a copy of the recovery image, for example see: https://github.com/kholia/OSX-KVM

Notes:

  • Linux system is needed to download the image using the script from above
  • Fix the paths as per your filesystem
  • Most CPU flags here may not be essential, but the system will freeze without +xsave
  • The BaseSystem image is around 3GB, the installed disk will expand to around 40GB but only 15GB used
  • WHPX crashes using separate OVMF CODE & VARS, so combine these to a single file:
copy /B OVMF_VARS.fd + OVMF_CODE.fd OVMF_combined.fd
qemu-system-x86_64w.exe -accel whpx -machine q35 -cpu Westmere,vendor=GenuineIntel,+pcid,+ssse3,+sse4.2,+popcnt,+avx,+aes,+xsave,+xsaveopt,check -m 4096 -vga std -audiodev dsound,id=snd0 -device ich9-intel-hda -device hda-duplex,audiodev=snd0 -hda "OpenCore\OpenCore.qcow2" -hdb "mac_hdd_ng.qcow2" -hdc "BaseSystem.img" -rtc base=localtime -bios "OVMF_combined.fd" -device nec-usb-xhci,id=xhci -device usb-tablet -device usb-kbd -global nec-usb-xhci.msi=off -device isa-applesmc,osk="ourhardworkbythesewordsguardedpleasedontsteal(c)AppleComputerInc" -smbios type=2 -nodefaults -netdev user,id=net0 -device virtio-net-pci,netdev=net0,id=net0,mac=52:54:00:11:22:33 -device ich9-ahci,id=sata

This was tested using Qemu 7.2.0, on an 2018 Intel i5 host running Windows 10.