Mac hosting guide

Set Up Buildkite Agents on a Hosted Mac for iOS CI

Install buildkite-agent with Homebrew, set your token and Xcode tags in buildkite-agent.cfg, then route iOS steps with an agents block in pipeline.yml. The whole setup takes a few commands.

Figment editorial teamPublished Updated Facts checked November 10, 2026

Figment Mac plans

US East. Pay before use. Hourly and daily too.

Intel Mac VM4 shared vCPUs, 4GB RAM, 80GB SSD$25per monthApple Silicon Mac VM4 shared vCPUs, 4GB RAM, 65GB SSD$39per monthDedicated M4 Pro12-core CPU, 24GB RAM, 512GB SSD$199per month

Minimum first purchase: $25 of account credit, used for your rental.

Install the agent with Homebrew, put your token and Xcode tags in buildkite-agent.cfg, and route iOS steps to it with an agents: block in pipeline.yml. The commands below take a hosted Mac from a blank terminal to a tagged agent that builds, signs and uploads. Keep the Buildkite macOS install docs and the Buildkite pipeline step reference open while you work.

When does a dedicated Mac beat a GitHub-hosted runner?

When you run more than a handful of iOS builds a day, because flat-rate hardware keeps caches and signing setup warm. The two models solve different problems:

FactorGitHub-hosted macOS runnerSelf-hosted Buildkite agent on a Mac
Billing modelPer-minute, metered against your Actions allotmentFlat monthly rate for the host
Xcode versionsWhatever GitHub's image shipsAny version you install
Caches between jobsDiscardedPreserved on disk
Signing identityRe-imported each jobInstalled once in a persistent keychain
ConcurrencyShared pool, queuedAs many executors as the Mac can sustain

The crossover depends on your per-minute rate and build length, so work the math with your own numbers before choosing.

How do I install the Buildkite agent on the Mac?

Open a terminal on the Mac over SSH or the remote desktop, then install from the official Buildkite tap and write your token into the config:

# Install the agent from the official Buildkite tap
brew install buildkite/buildkite/buildkite-agent

# Write your agent token into the installed config
sed -i '' "s/xxx/INSERT-YOUR-AGENT-TOKEN-HERE/g" \
  "$(brew --prefix)/etc/buildkite-agent/buildkite-agent.cfg"

Get the token from your Buildkite organization under Agents → New Agent. Config paths differ by architecture (see the install docs):

ArchitectureConfig path
Apple silicon/opt/homebrew/etc/buildkite-agent/buildkite-agent.cfg
Intel/usr/local/etc/buildkite-agent/buildkite-agent.cfg

Smoke-test the connection:

buildkite-agent start
# Look for: "Starting buildkite-agent" followed by "successfully connected"

Stop it with Ctrl-C and move on to tags.

How do I tag the agent by Xcode version?

Add a tags line to the config. Buildkite picks an agent by matching tags: a step that declares agents: { xcode: "16" } runs only on an agent that advertises xcode=16, and every key on the step must match.

A working buildkite-agent.cfg for an Apple silicon Mac:

# buildkite-agent.cfg: Apple silicon CI node
token="INSERT-YOUR-AGENT-TOKEN-HERE"

# Agent display name; %n differentiates spawned siblings
name="mac-ci-%n"

# Routing tags consumed by pipeline.yml
tags="xcode=16,os=macos,arch=arm64,queue=ios-builds"

# Build workspace (Apple silicon default)
build-path="/opt/homebrew/buildkite-agent/builds"

# Hooks directory (pre-command, post-command, etc.)
hooks-path="/opt/homebrew/etc/buildkite-agent/hooks"

# Number of concurrent agents from one config. Start at 1 and raise it
# after you measure (see the section on running several agents).
spawn=1

Set the Xcode tag to the version you actually install. Apple lists Xcode 26.0 to 26.3 for macOS Sequoia. Xcode 26.4 and later need macOS Tahoe 26.2 or later, and Xcode 27 needs Tahoe 26.6 or later, so those need an Apple silicon plan. Apple silicon-only (arm64-only) binaries and visionOS also need Apple silicon. See Apple's porting notes for Apple silicon.

If you are migrating from an older agent config, note that cancel-grace-period from agent v3 is replaced in v4 by --cancel-signal-timeout and --cancel-cleanup-timeout. Check the v3-to-v4 upgrade guide before copying older snippets.

Restart the service to pick up the changes:

brew services restart buildkite/buildkite/buildkite-agent

The agent should appear in the Buildkite UI under Agents.

How do I route iOS steps with pipeline.yml?

Put this at .buildkite/pipeline.yml in your repository. Replace the command paths and the scheme name with values that exist in your project.

# .buildkite/pipeline.yml
steps:
  - label: ":hammer_and_wrench: Build iOS"
    key: build-ios
    command: ".buildkite/scripts/build-ios.sh"
    agents:
      xcode: "16"
      os: macos
      arch: arm64
    timeout_in_minutes: 30
    artifact_paths: "build/**/*.ipa"

  - label: ":test_tube: Unit tests"
    key: test-ios
    command: ".buildkite/scripts/test-ios.sh"
    agents:
      xcode: "16"
      arch: arm64
    timeout_in_minutes: 20

  - label: ":rocket: Upload to TestFlight"
    key: upload-testflight
    command: "bundle exec fastlane beta"
    depends_on: build-ios
    agents:
      xcode: "16"
      queue: ios-builds
    timeout_in_minutes: 15

Inside build-ios.sh, call xcodebuild with flags that exist: -project or -workspace, -scheme, -configuration, -destination, and -derivedDataPath. Start the script with set -euo pipefail so Buildkite marks the job red on a failure instead of recording a fast but broken run.

How do I open the signing keychain and clean the workspace?

Use agent hooks, which live in hooks-path. Store the keychain password in Buildkite's pipeline Environment Variables and reference it by name. Never commit it to the hook file, and do not export the agent's full environment to disk, because real secrets leak that way.

hooks/pre-command opens the signing keychain only when a step needs it:

#!/usr/bin/env bash
set -euo pipefail

if [[ "${BUILDKITE_LABEL:-}" == *"Build iOS"* || \
      "${BUILDKITE_LABEL:-}" == *"TestFlight"* ]]; then
  security unlock-keychain -p "$KEYCHAIN_PASSWORD" \
    "$HOME/Library/Keychains/CI.keychain-db"
  echo "--- keychain unlocked"
fi

Provisioning profiles are plain files, not keychain items. Install them to ~/Library/MobileDevice/Provisioning Profiles/ separately. Signing identities (certificate plus private key) belong in an encrypted .p12 that you import into the CI keychain during machine setup, not on every build.

hooks/post-command keeps disk use predictable:

#!/usr/bin/env bash
set -euo pipefail

rm -rf "$HOME/Library/Developer/Xcode/DerivedData/ModuleCache.noindex"
echo "--- DerivedData module cache cleared"

Mark both executable: chmod +x hooks/pre-command hooks/post-command.

If a build has to reach your own artifact store, binary cache, or a corporate TestFlight upload proxy, update the allowlist on that specific service. Do not add rules for invented App Store Connect IP ranges, because Apple does not publish a static range for upload traffic.

How many agents can one Mac run?

It depends on the chip, core layout and RAM, and we do not publish a benchmark. A conservative starting point is one executor per 8GB of installed RAM, then measure and adjust. spawn=2 launches two agent processes from one config, and each takes one executor slot. While a parallel build runs, watch the load:

top -l 5 -s 2 -o cpu | head -30

If wall-clock time jumps materially, drop spawn or move to a larger plan. VM vCPUs are shared, not reserved cores, so timings on a VM can also move with other load on the host.

How does the cost compare with other Mac hosts?

These are entry prices. Chip, RAM and disk differ across the plans, so compare the hardware column as well as the price.

Provider / planHeadline rate12-month spendWhat's listed on the vendor page
Figment Intel Mac VM$25/mo$3004 shared vCPUs, 4GB RAM, 80GB SSD, macOS Sequoia
Figment Apple Silicon Mac VM$39/mo$4684 shared vCPUs, 4GB RAM, 65GB SSD
Figment Dedicated M4 Pro 48 GB$349/mo$3,228 paid up frontWhole Mac: M4 Pro, 48GB RAM, 512GB SSD
CloudMac monthly$99.99/mo$1,199.88Mac mini M4, 16 GB, 256 GB (256 GB "Reserve now"; 512 GB/1 TB "Fully reserved")
CloudMac yearly$999/yr$999Same M4 base config, prepaid annual
MacStadium M4.S$149/mo$1,788M4, 16 GB, 256 GB; support and 99.99% uptime claim on the pricing page

Three observations from those numbers:

  • CloudMac's prepaid year at $999 is $531 more than twelve months of the Apple Silicon Mac VM ($468), but it is a whole M4 with 16 GB, where the VM has 4GB and shared vCPUs.
  • The Intel Mac VM is the lowest price in the set, but it runs Xcode 26.0 to 26.3 only. Pick it when your toolchain supports that range.
  • The Dedicated M4 Pro costs the most, and it is the only Figment row with a whole Mac and 48GB.

What Figment Mac should host a Buildkite agent?

For an Intel-compatible toolchain on Xcode 26.0 to 26.3, the Intel Mac VM at $25 a month hosts a Buildkite agent. For Xcode 26.4 or later, arm64-only binaries or visionOS, use the Apple Silicon Mac VM at $39 a month. If you run parallel builds or want steady timings, the Dedicated M4 Pro 48 GB at $349 a month is a whole Mac. Figment runs the Mac and network. You manage the agent, your CI and your signing accounts.

Related guides

Which Figment Mac fits this work?

Intel Mac VM from $25 a month, Apple Silicon Mac VM from $39, or a Dedicated M4 Pro for $199. Hourly and daily plans too. You pay before use, starting with at least $25 of account credit.

Choose a Mac plan