So far I've been looking into XNU source, the official Open Source site and the only documentation I found for it. In any case I wasn't able to really find something I can use for understand the internals of the Hypervisor Framework implemented in Swift and not in C.

I'm actually trying to write my own container runtime from scratch (for learning purposes) so if Apple open sourced this I hope to learn from that specific code base. I don't want to use something like qemu or libvirt (I want to feel the pain of implementing it from the ground up).

I wasn't able to find clues on the Xhyve sources.

So anything regarding docs for the internals, sources or whatever (deep knowledge) about the Hypervisor Framework will be really appreciated. BTW I was searching for C sources cause I want to use Rust and as you may know C & Rust are very interoperable.

Has Apple open sourced this portion of the code or published any notes on a code base they used for this effort?


1 Answer 1


The Hypervisor framework itself is not open-source - as such, you cannot get a copy of the source code for it (unless you happen to have an agreement with Apple for this purpose).

If you really wanted to examine how it specifically works, you could reverse engineer (disassemble) the binary to extract that knowledge. However, usually there is no point in doing so.

The corresponding kernel support for the HyperVisor framework is visible in the publicly available XNU source code. Note that here it is known under the name "hv". For example take a look here:


For learning purposes, I would recommend not trying to reverse-engineer the Hypervisor.framework, but instead just look at the source code (and all sorts of books, tutorials, courses, etc. available) for other hypervisors. It is generally extremely well documented and learning resources are readily available on how to make a hypervisor - for example using the Intel VT-X instructions.

If this wasn't for learning purposes, I wouldn't recommend implementing this part of the hypervisor yourself. Instead I would base container system on Apple's Hypervisor.framework, if you want to control and customize the rest of the system yourself (i.e. everything that is not the CPU), and I would recommend Apple's Virtualization framework if you want a relatively standard system and do not require customization of peripherals.

One of the main benefits of using Apple's frameworks (besides them being easy to use) is that you can make use of them from sandboxes apps in the App Store - and you do not need to maintain a kernel extension yourself - with all the practical issues they bring for users on modern macOS.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .