# Connect a Self-Hosted Mac to Bitrise CI Guide

Canonical: https://figment.so/blog/mac-bitrise-self-hosted-runner

Install the Bitrise DEN agent with Homebrew, register it with your runner pool's intro secret, then assign the pool to your app under Stacks & Machines. It takes a few commands.

For a Bitrise DEN self-hosted agent, install `bitrise-den-agent` with Homebrew on your rented Mac, register it with the intro secret from a Bitrise runner pool, then assign that pool to your app under **Settings → Stacks & Machines**. Your builds then run on a Mac you rent at a flat monthly price instead of cloud macOS slots.

Bitrise cloud macOS stacks are convenient until concurrency slots fill up during release crunches. A self-hosted DEN (Dedicated Environments Network) agent routes those builds to your own Mac, with tooling you control. This guide registers one Mac in a Bitrise runner pool, routes an app to it, and works a break-even against your current Bitrise minutes bill.

Primary references: Bitrise's [DEN on-premise runners documentation](https://docs.bitrise.io/en/bitrise-platform/infrastructure/running-bitrise-builds-on-premise.html) and Apple's [porting macOS apps to Apple silicon](https://developer.apple.com/documentation/apple-silicon/porting-your-macos-apps-to-apple-silicon) note on Intel Xcode support.

## When does a self-hosted agent pay off?

Bitrise cloud machines are a sensible starting point. The move to self-hosted makes sense when one or more of these is true:

- Builds routinely queue for several minutes during working hours.
- Engineers coordinate pushes to avoid colliding with release pipelines.
- Your monthly cloud-minutes bill for macOS is already approaching the price of a dedicated Mac.
- You need a specific Xcode, Ruby, or system library the cloud stack does not ship.

Bitrise's documentation is explicit that the DEN agent is not plug-and-play: you install the toolchain you need. On a Figment Mac the base macOS is in place; Xcode, CocoaPods, and Fastlane install once and persist between runs.

## What do I need before I touch the Mac?

Confirm these before running any install commands:

- Workspace Owner or Admin role on bitrise.io, which is required to create a runner pool and copy its intro secret.
- Shell access to the Mac. SSH and encrypted remote desktop come with the Intel Mac VM and the Dedicated M4 Pro. The Apple Silicon Mac VM has SSH and a Terminal in its browser desktop.
- Outbound HTTPS from the Mac to `https://den.services.bitrise.io` and `https://build-log.services.bitrise.io` (the two endpoints the agent actually talks to).
- Homebrew installed, and Xcode plus the Command Line Tools installed and licensed (`sudo xcodebuild -license accept`).

In Bitrise, go to **Workspace settings → Self-hosted agents**, create a runner pool (for example, `figment-mac`), and copy its agent intro secret. You will paste it once, during daemon install.

## How do I install and register the DEN agent?

Run these on the Figment Mac. The commands match the current Bitrise install instructions:

```bash
# Add the Bitrise DEN tap and install the agent + Bitrise CLI
brew tap bitrise-io/den-agent
brew install bitrise-den-agent
brew install bitrise

# Register the launchd daemon. Replace YOUR_INTRO_SECRET with the pool token.
sudo "$(brew --prefix)/bin/create_bitrise_daemon.sh" \
  --bitrise-agent-intro-secret=YOUR_INTRO_SECRET \
  --enable-agent-self-update
```

The script writes a launchd plist and starts the service. Confirm the agent is up:

```bash
sudo launchctl list | grep bitrise
curl -sI https://den.services.bitrise.io | head -1
curl -sI https://build-log.services.bitrise.io | head -1
```

A missing process or a connection error on either endpoint explains an "offline" status in the Bitrise UI; a `HTTP/2 200` or redirect is expected. Do not open these endpoints in any upstream allowlist unless the firewall is yours to change. Bitrise has no published IP allowlist to maintain on their side.

## How do I route an app to the self-hosted pool?

Routing has two parts. The pool assignment in the Bitrise web UI is the authoritative control.

1. **Assign the pool.** In bitrise.io, open the app → **Settings → Stacks & Machines** and select the self-hosted runner pool you created. New builds for this app will dispatch to agents in that pool.
2. **Optional: declare intent in `bitrise.yml`.** For multi-app templates or review visibility, add a `meta` block. The exact `machine_type_id` value depends on your workspace tier, so copy it from the UI rather than inventing one:

```yaml
format_version: "13"
default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git

meta:
  bitrise.io:
    # Copy stack and machine_type_id strings from the app's Stacks & Machines tab.
    stack: osx-xcode-16
    machine_type_id: <value from the Bitrise UI>

app:
  envs:
    - BITRISE_PROJECT_PATH: MyApp.xcworkspace
    - BITRISE_SCHEME: MyApp

workflows:
  build_and_test:
    steps:
      - activate-ssh-key: {}
      - git-clone: {}
      - cocoapods-install: {}
      - xcode-build-for-simulator:
          inputs:
            - scheme: $BITRISE_SCHEME
      - xcode-test:
          inputs:
            - scheme: $BITRISE_SCHEME
```

Replace `BITRISE_SCHEME` and `BITRISE_PROJECT_PATH` with the scheme and workspace your repository actually defines. Do not hand-edit secrets into YAML; keep API keys and signing material in Bitrise's secret store or a Keychain the daemon user can read.

## How do I validate the first build and the signing chain?

Trigger a manual build in Bitrise and watch the log for the agent hostname line Bitrise emits at startup. It will match the Mac's hostname, not a label you invent. Then make sure the daemon user has what it needs:

```bash
# The daemon runs as its own user, not your login shell.
sudo xcode-select --switch /Applications/Xcode.app
sudo xcodebuild -license accept

# Tail the agent log (Apple silicon Homebrew path).
tail -f /opt/homebrew/var/log/bitrise-den-agent.log
```

For signing, install the signing certificate into the daemon user's login keychain and reference provisioning profiles as files checked into a secure store or synced with Fastlane `match`. Do not export the whole shell environment to a plaintext file; it can contain API tokens. Transfer secret names into the Bitrise app's **Secrets** tab and leave the values in a password manager you control.

Fail fast if a step errors. Every command above exits non-zero on failure, and Bitrise step failures stop the workflow by default. Never treat a red build as a successful timing sample.

## How do I work out break-even against Bitrise cloud minutes?

Bitrise prices cloud macOS builds per concurrent machine slot and per build minute; the exact numbers depend on your current plan, so pull them from your Bitrise billing page before you finalize this. The structure of the decision is simple:

Let `R` = your macOS per-minute rate in USD, `M` = your average build minutes per calendar month, and `C` = the price of a Figment Mac you would replace them with.

- Monthly cloud cost = `R × M`.
- You break even against the **$39/month** Apple Silicon Mac VM when `M ≥ 39 / R`.
- You break even against the **$349/month** Dedicated M4 Pro when `M ≥ 199 / R`.

A concrete worksheet: at `R = $0.07/min` and `M = 2,500 minutes/month`, cloud cost is `0.07 × 2,500 = $175`. That is above the $39 Apple Silicon Mac VM line, so the VM saves 175 − 39 = $136 a month, and below the $349 Dedicated M4 Pro 48 GB line, which costs 349 − 175 = $174 a month more than staying on cloud. The break-even points are `39 / 0.07 ≈ 557 minutes` for the VM and `349 / 0.07 ≈ 4,986 minutes` for the Dedicated M4 Pro. Choose the Dedicated Mac only if you need its 48GB of memory, the whole chip or steady timings. Rerun the arithmetic with your actual rate card; do not assume a published per-minute price without checking it.

Capacity on one Mac is finite. How many parallel Xcode jobs a machine sustains depends on its resources: the VM has 4 shared vCPUs and 4GB, and the Dedicated M4 Pro 48 GB is a whole M4 Pro with 48GB. Measure wall-clock build time at one, two, and three concurrent pipelines and stop adding slots when per-job time inflates. Past that point, add a second Mac to the same runner pool and let Bitrise distribute jobs across both.

## What Figment Mac suits a self-hosted Bitrise runner?

The [Apple Silicon Mac VM](/mac-hosting#apple-silicon-vm) at $39 a month (4 shared vCPUs, 4GB RAM, 65GB SSD) suits one pipeline at a time and Xcode 26.4 or later. The [Dedicated M4 Pro 48 GB](/mac-hosting#dedicated-m4-pro) at $349 a month is a whole Mac with 48GB for parallel pipelines. The [Intel Mac VM](/mac-hosting#intel-vm) at $25 a month runs macOS Sequoia and can host a DEN agent for Intel-compatible builds with Xcode 26.0 to 26.3. 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. Figment runs the Mac and network; you manage the agent and your Bitrise account. See [Mac hosting](/mac-hosting) for plan details.

---

**Related guides:**
- [Jenkins iOS Build Pipeline on a Remote Mac](/blog/mac-jenkins-pipeline-ios-build)
- [Automate TestFlight Uploads from a CI Mac](/blog/mac-testflight-ci-distribution)
- [Xcode on Windows: Remote Mac Setup](/blog/mac-xcode-on-windows-remote-setup)
