OpenBSD-current now runs as guest under Apple Hypervisor
OpenBSD-current now runs as guest under Apple Hypervisor

### A New Chapter in Virtualization: OpenBSD-current Boots on Apple’s Hypervisor
In a significant development for both the OpenBSD project and developers using macOS, the latest development branch of OpenBSD, known as “-current,” has gained the ability to run as a guest virtual machine using Apple’s native Hypervisor.framework. This breakthrough effectively allows OpenBSD’s own Virtual Machine Monitor (VMM) to operate on top of macOS, providing a lightweight and integrated way to run OpenBSD VMs.
This work, primarily spearheaded by OpenBSD developer Mike Larkin, represents a major step forward in cross-platform compatibility. It allows users of modern Macs, including both Intel and Apple Silicon-based systems, to leverage OpenBSD’s powerful and secure virtualization tools, `vmd(8)` and `vmctl(8)`, directly on their host operating system.
#### How It Works: A VMM Backend for macOS
Traditionally, OpenBSD’s `vmm(4)` driver communicates directly with the CPU’s virtualization extensions (like Intel VT-x) to create and manage virtual machines. The new implementation introduces a different approach for macOS hosts. Instead of talking to the hardware, the `vmm` code has been adapted to use Apple’s Hypervisor.framework as its backend.
Essentially, when running on macOS, OpenBSD’s `vmd` acts as a client to the host’s hypervisor. It translates the requests to run a VM into API calls that Apple’s framework understands. This elegant solution avoids the need for complex kernel extensions or third-party virtualization software like VirtualBox or QEMU, offering a more native and potentially higher-performance experience.
#### Why This Matters
The implications of this development are far-reaching:
1. **Seamless Workflow for Developers:** Many developers use macOS as their primary work environment but need to test or build software for OpenBSD. This integration dramatically simplifies that workflow. They can now spin up an OpenBSD-current VM using familiar OpenBSD tools without leaving their macOS terminal.
2. **A Gateway to Apple Silicon:** While the initial work focuses on running OpenBSD/amd64 guests, this lays the crucial groundwork for running OpenBSD/arm64 guests on Apple Silicon (M1/M2/M3) Macs. This has been a long-sought-after capability, and this port of `vmd` is a critical piece of the puzzle.
3. **Lightweight and Secure:** By leveraging the host OS’s native virtualization framework and OpenBSD’s famously clean and simple `vmd` daemon, users get a solution that is both resource-efficient and built on a foundation of security-conscious code.
4. **A Testament to Portability:** This achievement is a powerful demonstration of the OpenBSD project’s commitment to writing clean, portable, and well-architected code. The ability to retarget the VMM from bare metal hardware to a high-level OS framework is a testament to its design.
#### Getting Started
As this feature is brand new and part of OpenBSD-current, it’s intended for developers and testers comfortable with building software from source. The process involves checking out the OpenBSD source tree on a macOS machine and building the `vmd` userland tools.
Once built, a user can create a simple `vm.conf` file and use the `vmctl` command to create, start, and manage an OpenBSD guest, just as they would on a native OpenBSD host.
The future is bright for this project. As development continues, we can expect to see further refinements, performance improvements, and expanded support for different guest architectures. This is a fantastic example of open-source innovation bridging ecosystems and providing powerful new tools for the entire development community.
