Architecture
The
.bazelversion file in the bazel-buildfarm source repo controls which Bazel version is used to build buildfarm itself. Pin it to 8.x before building the JARs. Your project’s Bazel client version (8.x or 9.x) is unaffected. This does not apply to BuildBuddy setups.Option 1: Open-source RBE with bazel-buildfarm
What you need
- One Ubuntu VM (or bare-metal Linux) for the buildfarm server and Redis. This can be a co-located VM in your MacStadium environment.
- One or more Orka VMs as macOS workers. Scale the worker count to match your parallelism target.
- Your Bazel client (local dev machine or CI runner) with network access to the buildfarm server.
Set up the buildfarm server
On your Ubuntu VM: Install Java:~/buildfarm/server-config.yml:
The backplane type is
SHARD, not REDIS. Use a flat YAML config. The config.minimal.yml in the examples directory uses a preprocessor format the server does not support at runtime.8980 by default.
Prepare your Orka worker image
Create a base macOS VM image with the following installed. You’ll deploy multiple workers from this image, so getting it right once avoids repeating the setup on each VM. Install Xcode: Download Xcode from developer.apple.com. Launch it, accept the license agreements, and complete the initial setup. Make sure the version matches your project’s minimum Xcode requirement. Install Homebrew:--copt flags work around a macOS deployment target issue in abseil-cpp and protobuf:
Deploy and configure workers
For each worker, deploy an Orka VM from your base image and configure it to point at the buildfarm server. Deploy a worker VM:~/buildfarm/worker-config.yml:
publicName field must be unique for each worker. Use each VM’s IP address. Workers that share a publicName will conflict.
Start the worker:
Scale the worker pool
Because all workers use the same base image and the same buildfarm server address, scaling is straightforward: deploy more Orka VMs from the base image, set a uniquepublicName on each, and start the worker process.
A reasonable starting point for iOS simulator workloads is one worker VM per Orka node, with each VM sized to leave headroom for simulator processes. For compile-bound Bazel actions, higher VM density per node is fine since those workloads are CPU-bound rather than I/O-bound.
If you’re running parallel simulator tests across multiple VMs on the same node and see I/O slowdowns, the bottleneck is disk contention from concurrent simulator writes, not virtualization overhead. Distribute across more nodes at lower VM-per-node density rather than reducing the total VM count.
Connect your Bazel client
Add the following to your project’s.bazelrc:
bazel clean --expunge and build again. The second build should show remote cache hit for most actions and complete significantly faster.
Expected output on a warm cache:
Option 2: BuildBuddy with Orka
If your team is already using BuildBuddy as your RBE control plane, Orka VMs can serve as the self-hosted Mac executors that BuildBuddy dispatches work to. This keeps Orka in the stack as the macOS worker layer: clean VM boots, OCI image versioning, and node failover even when BuildBuddy is handling scheduling and caching. For teams evaluating options, the OSS buildfarm path above is the recommended starting point. It gives you full control over the stack, no additional vendor dependency, and the same Orka worker benefits.BuildBuddy’s snapshot-based warm-runner technology (Firecracker) is Linux-only. On macOS, BuildBuddy falls back to runner recycling, keeping the executor process alive between invocations rather than snapshotting it. Orka VM snapshots work independently of this and are available regardless of which RBE control plane you use.
What you need
- An existing BuildBuddy deployment (cloud or self-hosted).
- One or more Orka VMs as macOS executors.
- Your Bazel client with network access to BuildBuddy’s gRPC endpoint.
Prepare your Orka executor image
Install the following on a base macOS VM: Xcode: Download from developer.apple.com. Accept the license and complete setup. Homebrew:buildbuddy-executor binary for macOS/ARM from BuildBuddy’s GitHub releases. Move it to a stable path:
/etc/buildbuddy/executor.yaml:
remote.buildbuddy.io with your BuildBuddy server address.
Run the executor:
/Library/LaunchDaemons/io.buildbuddy.executor.plist:
Connect your Bazel client
Add the following to your.bazelrc:
Automate worker lifecycle with GitHub Actions
The manual steps above work for static worker pools that stay running. For ephemeral workers that spin up per build and tear down when it’s done, you can drive the whole thing from a GitHub Actions workflow. This pattern works for both the buildfarm and BuildBuddy setups; the difference is just what’s installed on the worker image.Set up worker auto-start in the base image
The key to making ephemeral workers viable is having the worker process start automatically when the VM boots, so the GitHub Actions workflow doesn’t need to SSH into each VM to configure it. Do this once when building your base image, then save it. Create a startup script at/Users/admin/buildfarm/start-worker.sh:
publicName on each boot to match MY_IP. This matters: if publicName is set to just :8981 (no hostname), the server will fail every findMissingBlobs call with Invalid DNS name: :8981. For a single-node setup where the server and worker share a VM, 127.0.0.1 is correct. For a multi-node setup where workers are on separate VMs, set MY_IP to the IP the server can reach that worker on.
Create a LaunchDaemon at /Library/LaunchDaemons/io.macstadium.buildfarm-worker.plist:
The workflow
The workflow runs on a self-hosted runner that has access to your Orka cluster. The Linux VM running your buildfarm server is the natural home for it, since it’s already in the same network as your Orka nodes. Store your Orka service account token as a GitHub Actions secret (ORKA_SA_TOKEN). The runner must have orka3 installed and configured to point at your cluster (orka3 config set --api-url <ORKA_ENDPOINT>).
- Service account auth: Store the SA token as a long-lived secret (generated once with
orka3 sa token <name> --no-expiration). In CI, authenticate withorka3 user set-token. User tokens fromorka3 loginexpire after an hour and will fail mid-build. See Manage service accounts for setup. - Worker count:
WORKER_COUNTis the lever for parallelism. Start at 2-4 and increase if your build has enough parallelizable actions to justify it. Each VM adds to your cluster’s VM slot consumption. - The 45-second wait: Covers VM boot plus the time for the LaunchDaemon to start the buildfarm worker process and register with the server. Adjust down if your cluster consistently boots faster; adjust up if you see “no workers available” errors on the first few actions.
if: always()on teardown: Ensures VMs are cleaned up even when the build fails. Without this, a failed build leaves orphaned VMs running until someone deletes them manually.- Unique VM names: Appending
github.run_idto the VM name avoids naming collisions when multiple builds run in parallel.
Scale across multiple runs
If your team runs many concurrent builds, theWORKER_COUNT per workflow multiplies by the number of parallel runs. Watch your cluster’s available VM slots in the Orka web UI. For sustained high-concurrency usage, a persistent warm pool (always-on workers) is more efficient than deploying and tearing down per-build, since it avoids per-build boot latency and VM slot churn.
For both setups, a shared remote cache means build outputs survive VM restarts and are shared across all workers and clients. The simplest approach is running bazel-remote on your Linux VM:
Why Orka for the worker pool
Bazel RBE handles scheduling, caching, and build orchestration. What it doesn’t provide is the macOS worker fleet itself. Running Bazel RBE on macOS requires clean, versioned, isolated Mac workers that don’t turn into an ops problem at scale. That’s what Orka handles.- Clean workers on demand. Deploying a fresh Orka VM from a versioned OCI image takes seconds. Bare-metal re-imaging takes hours: DEP enrollment, a full Xcode install, re-configuration. At CI cadence, that’s not a viable clean-boot story.
- Pinned build environments. Bazel pins toolchain state into the action hash. If your worker’s Xcode version or SDK drifts, cache hits collapse. Orka’s OCI image support lets you version and pin your build environments using any OCI-compatible registry (ghcr.io, ECR, etc.), the same way you’d pin a container image. Bare metal has no equivalent primitive.
- Isolation per project or team. VMs are isolated by definition. If one build poisons a worker, it doesn’t affect other workers. On bare metal, a bad build corrupts the host until someone re-images it.
- Worker pool scaling without physical hardware. Deploy more workers from the same base image. Orka’s Kubernetes-native operator supports declarative pool sizing.
- Node failover. If an Orka node goes down, VMs reschedule to healthy nodes. A bare-metal host failure is a manual remediation.

