There are two major guides that I found to get this done:
- https://github.com/foxlet/macOS-Simple-KVM
- https://github.com/kholia/OSX-KVM (I have tried this).
I have tried this on wsl2 on windows 11 which supports kvm out of the box, those with a older kernel might have to build the kernel from sources to add kvm support. The steps to build the kernel from sources can be found here https://dev.to/nicole/running-macos-on-windows-10-with-wsl2-kvm-and-qemu-21e1.
Problems I faced during the setup
- Access to kvm is denied. This answer was supposed to work but I am unable to reload the rules, need to figure out why. https://unix.stackexchange.com/a/373931. As a temp fix I am changing the access rights on each boot.