arcbox-vz
Safe Rust bindings for Apple's Virtualization.framework, implemented on a bundled Swift shim.
Overview
This crate provides ergonomic, async-first bindings to Apple's
Virtualization.framework for creating and managing virtual machines on macOS.
All framework interaction lives in ArcBoxVZShim, a SwiftPM static library
under shim/ that build.rs compiles and links into the crate. Rust and
Swift meet at a hand-written C ABI: shim/Sources/ArcBoxVZShim/Exports.swift
(@_cdecl exports) and src/shim_ffi.rs (extern declarations) mirror each
other in a normative symbol order — review them side by side. The shim is
statically linked from this same build, so symbol drift is caught at link
time by the link_coverage test rather than a runtime version handshake.
Requirements
- macOS 13+ (the shim's deployment target)
- Xcode Command Line Tools (
xcode-select --install) —build.rsinvokesswift build - The
com.apple.security.virtualizationentitlement on any binary that creates VMs (configuration objects and capability queries work unsigned)
Usage
use ;
async
VM Lifecycle
| Method | Description |
|---|---|
start() |
Async start; resolves on the framework's completion |
stop() |
Force stop (destructive); resolves on completion |
pause() / resume() |
Pause / resume; resolve on completion |
request_stop() |
Send a graceful shutdown request to the guest |
state() |
Query the current VirtualMachineState |
License
MIT OR Apache-2.0