|
| 1 | +# macOS |
| 2 | + |
| 3 | +Honest current status of `elastos-runtime` on macOS, plus the named path |
| 4 | +to first-class support. |
| 5 | + |
| 6 | +> This document is the truthful Mac-side companion to |
| 7 | +> [`state.md`](../state.md) ("Support boundary"). If anything in this file |
| 8 | +> conflicts with the canonical [`PRINCIPLES.md`](../PRINCIPLES.md) or |
| 9 | +> [`state.md`](../state.md), those win. |
| 10 | +
|
| 11 | +## TL;DR |
| 12 | + |
| 13 | +- The runtime daemon **compiles and runs natively on macOS** today (Apple |
| 14 | + Silicon, `aarch64-apple-darwin`). Developers can build and iterate on |
| 15 | + the daemon code without a Linux VM. |
| 16 | +- `WASM` and `data` capsules — for example `home`, `system`, `chat-room`, |
| 17 | + `gba-emulator` — run natively on macOS with the same isolation |
| 18 | + guarantees they have on Linux (wasmtime sandbox + capability tokens). |
| 19 | +- `MicroVM` capsules **do not yet run on macOS**. The repo refuses to |
| 20 | + pretend otherwise: `elastos setup --list` will report |
| 21 | + `[skip] <name> — not available for darwin-arm64` for any `type: microvm` |
| 22 | + capsule. This is intentional fail-closed behaviour per |
| 23 | + [`PRINCIPLES.md` #11 *Fail Closed, Then Explain*](../PRINCIPLES.md). |
| 24 | +- The named, scoped project that makes macOS a first-class ElastOS host |
| 25 | + with **identical microVM isolation** to Linux is the **Apple |
| 26 | + Virtualization.framework backend** ([`vz-backend/PLAN.md`](vz-backend/PLAN.md)). |
| 27 | + |
| 28 | +## What runs natively on macOS today |
| 29 | + |
| 30 | +| Capsule kind | Substrate | Status on Mac | |
| 31 | +|---|---|---| |
| 32 | +| `type: wasm` (e.g. `home`, `system`, `chat-room`) | wasmtime, capability tokens | Same as Linux | |
| 33 | +| `type: data` (e.g. `documents`, `library`, `inbox`, `gba-emulator`) | static assets, served by gateway | Same as Linux | |
| 34 | +| `type: microvm` (e.g. `chat`, `agent`, `localhost-provider`, `did-provider`, `shell`, `webspace-provider`, `ipfs-provider`, `tunnel-provider`, ...) | KVM + crosvm | **Not on macOS yet.** See "Path to first-class support" below. | |
| 35 | + |
| 36 | +The browser-hosted Home surface |
| 37 | +(`http://127.0.0.1:8090/apps/home/`) and its child apps (System, Inbox, |
| 38 | +Documents, Library, Chat Room, GBA) are reachable from macOS through |
| 39 | +`elastos gateway`. This matches [`state.md`](../state.md) L88: *"The |
| 40 | +default Home path must remain a KVM-independent browser-hosted adapter |
| 41 | +so macOS and Windows stay in scope without pretending to offer Linux |
| 42 | +parity."* |
| 43 | + |
| 44 | +## Why MicroVM capsules don't run on Mac yet |
| 45 | + |
| 46 | +ElastOS's central security thesis — *every `type: microvm` capsule in |
| 47 | +its own hardware-isolated microVM, communicating only through Carrier |
| 48 | +with explicit capability tokens* — is true on Linux via KVM + the |
| 49 | +[`elastos-crosvm`](../elastos/crates/elastos-crosvm/) crate. KVM is a |
| 50 | +Linux-kernel feature; macOS does not have it. |
| 51 | + |
| 52 | +The runtime preserves that contract by failing closed when the |
| 53 | +substrate is missing, rather than silently swapping to a weaker |
| 54 | +isolation model. The supervisor explicitly checks: |
| 55 | + |
| 56 | +```rust |
| 57 | +// elastos/crates/elastos-server/src/supervisor.rs (L930) |
| 58 | +if !elastos_crosvm::is_supported() { |
| 59 | + bail!("/dev/kvm not available — crosvm requires KVM. Cannot launch capsule '{name}'."); |
| 60 | +} |
| 61 | +``` |
| 62 | + |
| 63 | +That is the truthful, principled answer on Mac today: *the substrate is |
| 64 | +not available, so the capsule will not run.* Not a downgrade. |
| 65 | + |
| 66 | +> **Note on Slice B (commits `a02045e`, `a229638`, `d623ba7`):** an |
| 67 | +> earlier exploratory branch added darwin entries to |
| 68 | +> [`components.json`](../components.json) for `shell`, |
| 69 | +> `localhost-provider`, `did-provider`, and `webspace-provider`. Those |
| 70 | +> entries were misleading — they implied "this `type: microvm` capsule |
| 71 | +> runs natively on Mac" while in fact the runtime was launching them as |
| 72 | +> plain host-binary subprocesses without microVM isolation. The |
| 73 | +> Pre-Work step of [`vz-backend/PLAN.md`](vz-backend/PLAN.md) removes |
| 74 | +> those entries so the manifest tells the truth. The daemon-portability |
| 75 | +> improvements from those same commits (`pid_is_alive`, |
| 76 | +> `ELASTOS_DATA_DIR`, smoke-script Bash 3.2 portability, the |
| 77 | +> [`elastos-crosvm`](../elastos/crates/elastos-crosvm/) `cfg`-gated |
| 78 | +> non-Linux build) are preserved — they are universally-good |
| 79 | +> portability work and do not touch the Linux microVM substrate. |
| 80 | +
|
| 81 | +## Path to first-class support |
| 82 | + |
| 83 | +The named, scoped project is the **Apple Virtualization.framework |
| 84 | +backend**. Read the full plan in |
| 85 | +[`vz-backend/PLAN.md`](vz-backend/PLAN.md). Headlines: |
| 86 | + |
| 87 | +- **Strategy.** Add `elastos-vz` as a *sibling* crate to |
| 88 | + [`elastos-crosvm`](../elastos/crates/elastos-crosvm/), implementing |
| 89 | + the same |
| 90 | + [`ComputeProvider` trait](../elastos/crates/elastos-compute/src/traits.rs) |
| 91 | + on top of Apple's `Virtualization.framework`. No edits to |
| 92 | + [`elastos-crosvm`](../elastos/crates/elastos-crosvm/). No edits to |
| 93 | + the trait. No edits to the capsules. No edits to Carrier. No edits to |
| 94 | + the capability-token plane. Linux execution path byte-equivalent to |
| 95 | + pre-change. |
| 96 | +- **End state.** Every `type: microvm` capsule artifact that runs on |
| 97 | + Linux runs on Mac with **identical hardware-enforced isolation, |
| 98 | + identical Carrier semantics, identical capability tokens, identical |
| 99 | + fail-closed behaviour**. The capsule itself does not know it is on |
| 100 | + Mac. |
| 101 | +- **Effort.** 6–10 weeks for one focused systems-Rust engineer, phased |
| 102 | + Pre-Work → Phase 0 (1 wk research) → Phase 1 (scaffold) → Phase 2 |
| 103 | + (first guest boot) → Phase 3 (virtio plumbing) → Phase 4 (first |
| 104 | + capsule end-to-end) → Phase 5 (hardening) → Phase 6 (ship). |
| 105 | + |
| 106 | +## Honest trust delta |
| 107 | + |
| 108 | +For [`PRINCIPLES.md` #12 *Docs, Code, Tests, and Ops Must Agree*](../PRINCIPLES.md), |
| 109 | +the one honest difference between Linux and macOS isolation that the |
| 110 | +Vz backend does *not* erase: |
| 111 | + |
| 112 | +| | Linux today | macOS after Vz backend | |
| 113 | +|---|---|---| |
| 114 | +| Hardware isolation | CPU virt extensions (VT-x / SVM / ARM EL2) | CPU virt extensions (Apple Silicon EL2) | |
| 115 | +| Hypervisor | [`elastos-crosvm`](../elastos/crates/elastos-crosvm/) — open source, auditable, vendored | Apple `Virtualization.framework` — closed source, signed and shipped with macOS | |
| 116 | +| Trust source | We audit crosvm | We trust Apple's signed binary | |
| 117 | +| Integrity verification | Implicit (distro packaging) | Apple System Integrity Protection + binary code signing | |
| 118 | + |
| 119 | +**Net:** hardware-level isolation parity is full. The trust *source* |
| 120 | +differs. This is the same trade-off Docker Desktop, OrbStack, Lima, |
| 121 | +Tart, and every Mac-targeting VMM accepts. We disclose the delta |
| 122 | +honestly; we do not paper over it. |
| 123 | + |
| 124 | +The capability-token plane, the Carrier transport, the capsule |
| 125 | +artifact, and the fail-closed semantics are **unchanged** by this |
| 126 | +trade-off. |
| 127 | + |
| 128 | +## What this means for users today |
| 129 | + |
| 130 | +- **You can develop the daemon code on a Mac.** `cargo build` and |
| 131 | + `cargo test` work. The daemon process runs, gateway serves the |
| 132 | + browser Home, WASM and data capsules execute. |
| 133 | +- **You cannot run microVM capsules on a Mac.** Until the Vz backend |
| 134 | + lands, install of any `type: microvm` capsule will be skipped with a |
| 135 | + clear "not available for darwin-arm64" message. To run the full |
| 136 | + microVM-isolated ElastOS today, use Linux (`x86_64-linux` or |
| 137 | + `aarch64-linux`). |
| 138 | +- **If you need to test microVM capsules from a Mac**, run the runtime |
| 139 | + inside a Linux VM (Lima, Apple Vz-managed manually, or a remote |
| 140 | + Linux host) and connect to it. This mirrors how Docker Desktop and |
| 141 | + the Kubernetes control plane handle the Mac case. |
| 142 | + |
| 143 | +## Cross-references |
| 144 | + |
| 145 | +- The plan: [`docs/vz-backend/PLAN.md`](vz-backend/PLAN.md) |
| 146 | +- The principles this plan obeys: [`PRINCIPLES.md`](../PRINCIPLES.md) |
| 147 | + (#10, #11, #12 in particular) |
| 148 | +- The runtime's support boundary: [`state.md`](../state.md) |
| 149 | + ("Support boundary" section) |
| 150 | +- The convergence context with PC2/Home: |
| 151 | + [`docs/PC2_CONVERGENCE.md`](PC2_CONVERGENCE.md) |
| 152 | +- The Linux microVM substrate (untouched by this work): |
| 153 | + [`elastos/crates/elastos-crosvm/`](../elastos/crates/elastos-crosvm/) |
0 commit comments