macOS nodes
For iOS builds on a Mac (Apple silicon). Built, but not yet run on a Mac: the first setup on the real machine is also its test (see the end).
How it works
macOS has nothing container-like that can run Xcode safely (Apple's
container runs Linux only; Darwin chroot needs System Integrity Protection
off on the host), so a macOS node is a virtual machine, run by Tart on
Apple's Virtualization framework. A VM has its own kernel: a stronger boundary
than the Linux nodes' containers. The rest is the same idea as on Linux
(development.md):
| Linux | macOS | |
|---|---|---|
| runs as | user midas-node | user midas-node (hidden, no login) |
| node | rootless podman container | Tart VM, started at boot by launchd |
| boundary on the machine | nftables, keyed on the user | a pf anchor, loaded at boot: the VMs' network may reach this Mac only on the two forwarded hub ports, DNS and DHCP, and nothing private at all; no IPv6 |
| from the tunnel | only the node's ssh port | the same |
| limits | cgroups | the VM's CPUs and memory |
| image | Containerfile compiled into midas | a Packer template compiled into midas: Cirrus Labs' macOS with Xcode, plus Rust (aarch64-apple-ios, aarch64-apple-ios-sim), git-lfs, bun, QEMU (for a bare-metal kernel such as pinnacle's), and sshd hooked into midas |
| ports | pasta | midas node forward, as the node's user: tunnel → VM's sshd, and VM → hub (<gateway>:4791 → the API, :4792 → git), so the hub sees the node at this Mac's WireGuard address |
| updates | re-run setup | the same: the VM installs the owner's midas from a read-only shared folder at every start |
Apple's licence allows two macOS VMs per Mac, for software development: two nodes at most. On 64 GB, two nodes of 24 GB (the default) leave room for the host. No signing identities belong in a node; nodes build unsigned and simulator artefacts.
Setting one up
On the Mac, as an admin:
brew install cirruslabs/cli/tart hashicorp/tap/packer rustup
rustup default stable
git clone <the midas repository> && cd midas && cargo build --release
sudo install -d -m 755 /var/lib/midas/bin
sudo install -m 755 target/release/midas /var/lib/midas/bin/midas
WireGuard up with the Mac's workspace address (the official app, or
wireguard-tools). An agent adds the node — a second node on the same Mac
is the same with another name (it gets the next port):
midas nodes add mac-1 --machine mini --address 10.44.0.4 --renderer "Apple M5 Pro (VM)"
Then, on the Mac:
sudo /var/lib/midas/bin/midas setup mac-1 --hub 10.44.0.1:4791
Options: --memory 24g, --cpus 6, --disk 200 (GB), --image <tart image>,
--rebuild (a new VM from the image; its warm build directory starts over),
--remove. The first run downloads the image (tens of GB) and builds the VM.
What the warmer builds on a Mac goes in the hub's hub.conf, under
warm.machines.<machine> (steps, optional), since the iOS target is not
what the Linux nodes build.
To check on the first real setup
- that Tart runs a VM headless from a launchd job as the node's user, with nobody logged in;
- that the shared folder mounts in the guest at boot
(
/Volumes/My Shared Files/midas); - the vmnet gateway (
192.168.64.1unless the Mac says otherwise) and the bridge interface the IPv6 rule names; - that the pf anchor under
com.apple/is evaluated and survives a reboot; - from inside the VM with full control: the LAN, the Mac itself and the tunnel are unreachable, the hub's two ports and the internet are reachable (the same test as on Linux, README "Security");
- build times for the iOS target, VM against host.