reims-util

License: GPL-2.0-or-later OR LGPL-3.0-or-later

reims-util gets an x86-64 macOS VM ready to boot. It makes:

  • An OpenCore boot image, with the OVMF firmware to boot it, set up for a q35 VM on KVM.
  • macOS installers that reims-ctl takes as they are, from Apple and checked against Apple's own checksums and signatures:
    • an online installer, which installs the newest release of macOS 10.13 to 26 over the network;
    • an offline installer, which installs one exact release of macOS 11 to 26 with no network at all.

Downloads pick up where they stopped when they're interrupted.

It's made for reims-vgpu's reims-ctl, and does the job you'd otherwise use OSX-KVM or ULTMOS for. It's a single program with no other tools to install, and it runs on Linux and macOS.

Install

You need Rust 1.98.1 or later (rustup.rs). Then:

cargo install --locked --git https://github.com/steelbrain/reims-util

Or, from a checkout, cargo install --locked --path ..

Make a VM with reims-ctl

mkdir -p ~/vms/mac && cd ~/vms/mac
reims-util opencore                     # OpenCore.qcow2, OVMF_CODE.fd and OVMF_VARS.fd
reims-util online-installer tahoe       # macOS-Tahoe-online-installer.dmg
reims-ctl create mac --opencore OpenCore.qcow2 \
  --installer macOS-Tahoe-online-installer.dmg --start

reims-ctl copies the OpenCore image into the VM, finds OVMF beside it, and takes the installer as it is. OpenCore's picker boots "macOS Base System" after 5 seconds, and you're in macOS Recovery: erase the VM's disk in Disk Utility, then pick Reinstall macOS, which downloads the rest from Apple.

Use it interactively

Run reims-util with no arguments. A small interface opens at the bottom of your terminal (it doesn't take over the screen): pick a job, fill in its form, and press Enter to start it. Esc stops a download (press it again to leave without waiting), and starting it again picks up where it left off. What each job wrote, or why it failed, stays in your terminal once you quit.

Use it from the command line

Everything the interface does is a command too, which is what scripts and reims-ctl use.

OpenCore and OVMF

reims-util opencore -o OpenCore.qcow2

This writes a 128 MiB disk image with OpenCore 1.0.8 on its EFI partition: qcow2 for a .qcow2 name, and a raw disk image for anything else (.img). Beside it go OVMF_CODE.fd and OVMF_VARS.fd, with OVMF's licenses. What goes in them is downloaded from pinned sources (OpenCore's release, a commit of its picker icons and boot chime, OcBinaryData, and Lilu's release, from GitHub; OVMF from Arch Linux's edk2-ovmf package), checked against the hashes reims-util knows, and cached in ~/.cache/reims-util, so it's only downloaded once.

Each image gets a Mac identity of its own: a serial number, logic board serial (MLB), system UUID and ROM, which it prints when it's done. Keep them if you'll want the same identity in another image (--serial, --mlb, --uuid, --rom). The model is an iMac20,1 unless you ask for another with --model:

Model Runs
iMac20,1 macOS 10.15.6 to 26
iMacPro1,1 macOS 10.13 to 15

What's in the image, and why:

  • Two kexts, which load on macOS 26 alone: Lilu, and its plugin ReimsVgpu.kext, from this repository's kext/. macOS drives reims-vgpu's GPU with its own driver, whose x86-64 build asks the device for an old interface version (6) and turns every later feature off. The kext has it ask for the one arm64 guests use (245), and patches what the driver and its Metal plugin hardcode, so Metal offers the GPU families GPU-accelerated Chrome needs, and D32S8 depth/stencil textures. --no-kexts leaves them out, and the boot argument -reimsvgpuoff turns the kext off. The apv-arm64-port kexts load after these, on macOS 26.4 and later (below). There are no others: QEMU's isa-applesmc is the SMC.
  • The drivers a VM boots with: OpenRuntime, OpenHfsPlus (recovery images and installers are HFS+), OpenPartitionDxe (for older recovery images) and ResetNvramEntry.
  • The graphical picker, OpenCanopy, with the GoldenGate icons. Pick with the arrow keys, Tab and Enter; it has no mouse pointer in a VM. --text-picker gives OpenCore's text list instead.
  • The boot chime, which plays on the VM's Intel HD Audio controller when it has one (QEMU's ich9-intel-hda with an hda-output codec). Turning off "Play sound on startup" in macOS's Sound settings silences it.
  • One ACPI table, with the EC and USBX devices macOS looks for.
  • The CPU reported as a Skylake-SP, which every macOS from 10.13 to 26 knows, whatever CPU model the VM has. --no-cpuid-spoof turns that off.
  • macOS doesn't see it runs in a VM, so iCloud and the App Store let you sign in. --show-vm turns that off.
  • System Integrity Protection on, as on a real Mac. --disable-sip turns it off.

--timeout sets how long the picker waits (0 waits for you), --boot-args the kernel's boot arguments, and --verbose-boot shows the kernel's messages while it boots. reims-util opencore --help lists the rest.

Online installers

reims-util online-installer list
reims-util online-installer sonoma -o ~/vms/mac

An online installer is Apple's recovery image for a macOS, as a Mac's Internet Recovery gets it: about 1 GB, written as macOS-<name>-online-installer.dmg. A VM boots it into macOS Recovery, whose Reinstall macOS downloads and installs the newest release of that macOS. Name a version by name (sonoma, big-sur), number (14, 10.15) or latest. The image is checked against its chunklist, which Apple signs, 10 MiB at a time, so what you get is byte for byte what Apple made.

Offline installers

reims-util offline-installer list
reims-util offline-installer 26.6.2 -o ~/vms/mac

Recovery always installs the newest release of its macOS, downloaded as it goes. To install a particular one, such as 26.6.2 when 26.7.1 is out, or to install with no network, make an offline installer: a disk image, macOS-<name>-<version>-<build>-offline-installer.img, of 13 to 20 GB. It holds the recovery image of that macOS, which OpenCore boots as it would from a USB stick, and Apple's full installer for that release, with a script that installs it.

offline-installer list shows the releases Apple's software update catalog has for Intel Macs; macOS 27 runs on Apple silicon only, so it isn't there. Name one by version (26.6.2, or 26 for the newest 26), build (25G83), name (tahoe, for the newest Tahoe), Apple's product ID (140-93587) or latest. Both of its files are downloaded straight into their places in the image, each checked against Apple's chunklist for it, so the installer, up to 18 GB, is never on your disk twice.

reims-ctl create mac --opencore OpenCore.qcow2 \
  --installer macOS-Tahoe-26.6.2-25G83-offline-installer.img --start

reims-ctl uses the image where it is, read-only, so it isn't copied again. Once you're in Recovery:

  1. Open Disk Utility and erase the VM's disk as APFS. You can leave its name as it is.

  2. Quit Disk Utility, open Utilities > Terminal, and run:

    sh /Volumes/Installer/install-macos.sh
    

The script puts "Install macOS ….app" on the disk you erased and starts it; the VM restarts into the installer, and goes on from there as any macOS install does.

Interrupted downloads

An installer is written as a .part file next to where it ends up. If it stops, whether you pressed Ctrl-C, the network dropped or the machine went to sleep, run the same command again: what's there is checked against Apple's chunklists and the download continues from there. An installer that's already complete and checks out isn't downloaded again, and one that doesn't is repaired. An offline installer whose recovery image Apple has since replaced is left as it is: it still boots, and a VM may be using it.

For scripts

--json prints progress and the result as JSON lines on stdout. The last line is either {"event":"done","result":{…}}, with what was written (and for opencore, the identity it made) or, for list, the versions, or {"event":"error","message":"…"}.

reims-util --json online-installer tahoe -o ~/vms/mac

The ReimsVgpu kext

kext/ holds ReimsVgpu.kext's source. A kext builds on a Mac alone, while reims-util builds anywhere, so the built kext is in the repository too, at kext/ReimsVgpu.kext, and that's the one reims-util puts in its images. After changing the source, rebuild it on a Mac with Xcode, and commit it with the change:

cd kext
make LILU=path/to/Lilu.kext KERNEL_SDK=path/to/MacKernelSDK

LILU is a DEBUG build of Lilu 1.7.2, the version the image carries, from Lilu's releases, and KERNEL_SDK a checkout of MacKernelSDK. With the same Xcode, the same source builds the same bytes. make also writes kext/sources.sha256, what the kext was built from, and cargo test fails when the source no longer matches it.

apv-arm64-port

apv-arm64-port drives reims-vgpu's GPU on macOS 26.4 and later with kexts of its own, which every image carries by default; older macOS 26 builds keep macOS's own driver with ReimsVgpu.kext. --no-apv-arm64-port makes an image without them.

License

reims-util is licensed under GPL-2.0-or-later OR LGPL-3.0-or-later; see LICENSE. The serial number tables come from OpenCorePkg's macserial, and the built ReimsVgpu.kext holds code of Lilu's, each under its BSD-3-Clause license. OpenCore, its picker icons and chime (OcBinaryData), Lilu and OVMF, which reims-util downloads, keep their own licenses.

Languages
Rust 100%