Mac hosting guide

Parallel Xcode Schemes to Cut CI Build Time

Try -parallelizeTargets, -jobs and parallel testing on one scheme first. Fan out across schemes only for independent artifacts or different signing identities, and watch memory on a shared-vCPU VM.

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.

Turn up Xcode's built-in parallelism on a single scheme first, and fan out across schemes only for independent artifacts, separate signing identities or destinations one xcodebuild cannot cover. The scheme editor has a Parallelize Build checkbox, and xcodebuild -help on Xcode 16.4 lists -parallelizeTargets ("build independent targets in parallel"), -jobs NUMBER, -parallel-testing-enabled YES|NO and -maximum-parallel-testing-workers NUMBER. Cross-scheme fan-out can easily make a small runner slower, not faster.

What does Xcode's built-in parallelism already do?

Apple's Build targets in parallel help page says enabling Parallelize Build on a scheme makes "the build system choose the best order for building targets, based on the dependencies declared in your project." The same page warns that enabling it also disables the ordering you configured in Target Dependencies build phases and the scheme's Build action, so your dependency declarations have to be accurate.

On the command line, a single xcodebuild -workspace W.xcworkspace -scheme S build -parallelizeTargets -jobs <N> keeps independent frameworks compiling in parallel across the cores you give it. For tests, -parallel-testing-enabled YES farms test classes to several XCTest workers inside one invocation. If this baseline is fast enough, add the flags and stop here.

Apple's command-line guide explains workspace, scheme and destination selection. For parallel testing, inspect xcodebuild -help from the exact Xcode release on your runner, and compare its built-in test scheduling with your proposed fan-out before you change the pipeline.

When does fan-out across schemes help?

It helps in a short list of situations:

  • The workspace produces more than one independent artifact, for example a main app plus a separately distributed framework, CLI or SDK, that you want to build concurrently instead of in sequential pipeline stages.
  • Your measurements show a gap that the installed Xcode release's built-in multi-destination test scheduling does not solve.
  • Different product groups must use different signing identities, provisioning profiles or configurations, so a single xcodebuild invocation cannot cover them.

When does fan-out make builds slower?

Concurrent xcodebuild processes do not share Swift Package resolution, module caches, DerivedData or indexing state. Each extra process re-fetches packages, re-parses modules and competes for memory at link time. On a runner with few cores or little RAM, three concurrent xcodebuild processes can be slower than one scheme with -parallelizeTargets -jobs 2, because they compete for CPU time and all hold working data in RAM. Watch peak resident memory. If it approaches total RAM, the host is swapping and wall-clock time goes up, not down.

The built-in scheduler is cheap, knows your dependency graph and is already running. Treat fan-out as an orchestration layer for cases it cannot express.

How do I orchestrate a fan-out safely?

Use a compile-only script that gives each scheme its own derived data and result bundle. The script below takes the workspace as the first argument and each scheme name as its own quoted argument, so scheme names with spaces survive. Nothing in it rm -rfs a path derived from a scheme name. Each child gets its own index directory under a mktemp run directory, with its own -derivedDataPath and -resultBundlePath. There is no default destination and no default scheme. A trap kills still-running children on SIGINT or SIGTERM. Every child's exit status is checked, and the parent exits non-zero if any build failed, so a broken scheme is never counted as a fast build.

There is no xcresulttool merge call. xcrun xcresulttool merge --help on Xcode 16.4 shows --output-path <output-path> <paths> ... for two or more bundles, but a merged bundle is rarely what CI wants. Attach each per-scheme bundle as its own artifact and keep them legible.

#!/usr/bin/env bash
# parallel-build.sh — compile-only fan-out of xcodebuild across shared schemes.
#
# Usage:
#   ./scripts/parallel-build.sh <workspace.xcworkspace> <scheme1> [scheme2 ...]
#
# No default scheme, no default destination. Run once on your real project,
# read the per-scheme logs, then wire into CI.

set -euo pipefail

if [[ $# -lt 2 ]]; then
  echo "Usage: $0 <workspace.xcworkspace> <scheme1> [scheme2 ...]" >&2
  exit 64
fi

WORKSPACE="$1"; shift
if [[ ! -d "$WORKSPACE" ]]; then
  echo "Workspace not found: $WORKSPACE" >&2
  exit 66
fi

RUN_DIR="$(mktemp -d -t parallel-xcodebuild.XXXXXX)"
echo "Run directory: $RUN_DIR"

pids=()
schemes=()

cleanup() {
  # Bash's job table contains this shell's children, not old reused PID values.
  local pid
  for pid in $(jobs -pr); do kill "$pid" 2>/dev/null || true; done
  wait || true
}
trap cleanup EXIT
trap 'exit 130' INT
trap 'exit 143' TERM

i=0
for scheme in "$@"; do
  # Reject empty names, path separators and newlines — defence in depth,
  # since the scheme name is never used to form a path but we still do
  # not want to pass something weird to xcodebuild.
  if [[ -z "$scheme" || "$scheme" == */* || "$scheme" == *$'\n'* ]]; then
    echo "Invalid scheme name: $scheme" >&2
    cleanup
    exit 65
  fi

  idx_dir="$RUN_DIR/$i"
  mkdir -p "$idx_dir"
  log="$idx_dir/build.log"
  derived="$idx_dir/DerivedData"
  result="$idx_dir/result.xcresult"

  echo "Starting [$i] scheme=$scheme"
  xcodebuild build \
    -workspace "$WORKSPACE" \
    -scheme "$scheme" \
    -derivedDataPath "$derived" \
    -resultBundlePath "$result" \
    > "$log" 2>&1 &
  pids+=("$!")
  schemes+=("$scheme")
  i=$((i + 1))
done

failed=0
for i in "${!pids[@]}"; do
  pid="${pids[$i]}"
  scheme="${schemes[$i]}"
  if wait "$pid"; then
    echo "OK   [$i] $scheme"
  else
    rc=$?
    echo "FAIL [$i] $scheme (exit $rc, log: $RUN_DIR/$i/build.log)" >&2
    failed=$((failed + 1))
  fi
done

if (( failed > 0 )); then
  echo "$failed scheme(s) failed; run directory kept at $RUN_DIR" >&2
  exit 1
fi

echo "All schemes built. Run directory: $RUN_DIR"

This is an untested example. Pass your own workspace and the exact scheme names that xcodebuild -list -workspace W.xcworkspace prints. If you extend it to xcodebuild test, add a -destination as an explicit argument from CI configuration. Do not bake a default destination into the script or share one destination across concurrent children on the same host.

How do I measure before I pick a plan?

Run three timing passes on the same idle host and compare only runs that exited with status zero:

  1. One scheme with the built-in scheduler: time xcodebuild build -workspace W.xcworkspace -scheme ALL -parallelizeTargets -jobs <cores>
  2. The fan-out script above across the schemes you want to split.
  3. The slowest individual scheme on its own, which is the floor fan-out can reach.

If (2) is not meaningfully better than (1), the dependency graph is the bottleneck and splitting will not help. If (2) is close to (3), you have hit the real limit for that host. If (2) is worse than (1), you are memory- or core-bound and need a bigger runner or fewer concurrent workers.

InputYour value
Single-scheme real with -parallelizeTargets____ min
Fan-out real across N schemes____ min
Slowest single scheme real on its own____ min
Peak resident memory across concurrent processes____ GiB
Available RAM on the runner____ GiB
Cores available to the runner____

If peak resident memory is close to available RAM, drop a worker or move to a larger plan. If (2) is within ten percent of (1), stay on one scheme and spend the engineering time on test parallelization (-parallel-testing-enabled YES) or dependency cleanup.

Which Figment Mac plan fits parallel Xcode work?

Pick by what your measured workload needs. We have not measured parallel build speed on any Figment plan, so use the table above on a daily rental. Prices are USD before tax.

Figment planResourcesFit for parallel Xcode work
Intel Mac VM, $25/month or $2/day4 shared vCPUs, 4GB RAM, 80GB SSD, macOS SequoiaOne scheme with built-in parallelism on Xcode 26.0 to 26.3 (the range Apple lists for Sequoia). 4GB RAM is a tight ceiling for multi-process fan-out.
Apple Silicon Mac VM, $39/month or $6/day4 shared vCPUs, 4GB RAM, 65GB SSDArm64-only simulators, visionOS and Xcode 26.4 or later (Xcode 27 needs macOS Tahoe 26.6 or newer). Light fan-out of two or three schemes.
Dedicated M4 Pro 48 GB, $349/month ($299 on a 12-month term)Whole Mac: M4 Pro, 48GB RAM, 512GB SSDSustained fan-out across several concurrent xcodebuild processes, where you want all cores and memory to yourself.

VM vCPUs are shared, not reserved cores. Apple's Porting your macOS apps to Apple silicon guide states, "If you need to run Xcode on an Intel-based processor, use Xcode 26 or earlier." Check the macOS version shown before purchase against Apple's Xcode table. You run your own CI on any plan.


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