Mac hosting guide

iOS Simulator Screenshot Regression Archive

Capture each build's screenshot with simctl on a fixed device and runtime, compare it with an approved baseline using ImageMagick, and archive the evidence on failure. It runs on any Mac with Xcode.

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.

Capture the same app state on the same iOS Simulator model and runtime for every build, compare each PNG with an approved baseline, and keep the current image, the difference image and the test result whenever a check fails. Use simctl for a deterministic screen, and XCTest when the app must reach a specific state first. Apple's Simulator screenshot reference

How do I choose the device and runtime?

List available devices with xcrun simctl list devices available, then record the runtime, device type, locale, theme and text size for each baseline. Reserve one device for this job and pass its UDID explicitly. Build the app for the iOS Simulator and use the resulting .app bundle.

Start with a small device matrix and run it in sequence on one Mac. Measure each boot and capture before you try parallel devices. Check which simulator runtimes your Xcode installation supports. Apple's guide to running apps in Simulator · Apple's Xcode requirements

How do I capture a screenshot and compare it with a baseline?

Save the script below as ci/simulator-snapshot.sh. Set SIMULATOR_UDID, SIM_APP, BUNDLE_ID and BASELINE_PNG in your CI job. Use a Debug fixture that starts in a stable, seeded state. When the intended screen is ready, have the fixture read the filename from SNAPSHOT_READY_FILE and write an empty file with that name in its temporary directory. Use the XCTest method further down when you need to drive the screen through interactions.

#!/usr/bin/env bash
set -euo pipefail
: "${SIMULATOR_UDID:?Use the UDID reserved for this CI job}"
: "${SIM_APP:?Set the path to the built simulator .app bundle}"
: "${BUNDLE_ID:?Set the app bundle identifier}"
: "${BASELINE_PNG:?Set the path to the reviewed reference PNG}"
out="${1:?Pass the output directory}"
mkdir -p "$out"

xcrun simctl bootstatus "$SIMULATOR_UDID" -b
xcrun simctl status_bar "$SIMULATOR_UDID" override --time "9:41"
xcrun simctl install "$SIMULATOR_UDID" "$SIM_APP"
data_dir="$(xcrun simctl get_app_container "$SIMULATOR_UDID" "$BUNDLE_ID" data)"
ready_name="snapshot-ready-$(uuidgen)"
SIMCTL_CHILD_SNAPSHOT_READY_FILE="$ready_name" \
  xcrun simctl launch --terminate-running-process "$SIMULATOR_UDID" "$BUNDLE_ID" -UITesting
for ((attempt = 0; attempt < 30; attempt++)); do
  [[ -f "$data_dir/tmp/$ready_name" ]] && break
  sleep 1
done
if [[ ! -f "$data_dir/tmp/$ready_name" ]]; then
  printf 'The screenshot fixture did not report readiness\n' >&2
  exit 1
fi
xcrun simctl io "$SIMULATOR_UDID" screenshot "$out/current.png"

if [[ ! -f "$BASELINE_PNG" ]]; then
  printf 'Missing approved baseline. Review %s/current.png\n' "$out" >&2
  exit 1
fi

baseline_size="$(magick identify -format '%wx%h' "$BASELINE_PNG")"
current_size="$(magick identify -format '%wx%h' "$out/current.png")"
if [[ "$baseline_size" != "$current_size" ]]; then
  printf 'Expected %s, got %s. Check the device and runtime.\n' \
    "$baseline_size" "$current_size" >&2
  exit 1
fi

status=0
magick compare -metric AE "$BASELINE_PNG" "$out/current.png" \
  "$out/diff.png" 2>"$out/ae.txt" || status=$?
if [[ "$status" != 0 && "$status" != 1 ]]; then
  cat "$out/ae.txt" >&2
  exit "$status"
fi

status=0
magick compare -metric SSIM "$BASELINE_PNG" "$out/current.png" \
  null: 2>"$out/ssim.txt" || status=$?
if [[ "$status" != 0 && "$status" != 1 ]]; then
  cat "$out/ssim.txt" >&2
  exit "$status"
fi
cat "$out/ssim.txt"

# ImageMagick writes its metric to stderr. Reject missing or malformed output.
python3 - "$out/ssim.txt" "${SSIM_FLOOR:-0.995}" <<'PY'
import math
import sys
from pathlib import Path

fields = Path(sys.argv[1]).read_text().split()
if not fields:
    raise SystemExit("ImageMagick returned no SSIM score")
score = float(fields[0])
floor = float(sys.argv[2])
if not (math.isfinite(score) and math.isfinite(floor) and 0 <= floor <= 1):
    raise SystemExit("Invalid SSIM score or threshold")
if score < floor:
    raise SystemExit(f"Screenshot similarity {score:.5f} is below {floor:.5f}")
PY

Use the device only for this job, and clear its status bar override as part of its normal reset. Set the threshold after capturing the same fixture several times, then add a deliberate visual change to verify the threshold fails for a real regression. ImageMagick's compare reference

How do I keep the evidence when a comparison fails?

Wrap the script in a Makefile target that archives the output and then returns the script's exit status. Place this at the root of the repository. If setup fails before a PNG is captured, the archive still contains the log.

.PHONY: simulator-snapshots
simulator-snapshots:
	@set -eu; \
	mkdir -p artifacts; \
	run=$$(mktemp -d artifacts/simulator.XXXXXX); \
	status=0; \
	bash ci/simulator-snapshot.sh "$$run" >"$$run/check.log" 2>&1 || status=$$?; \
	cat "$$run/check.log"; \
	tar -czf "$$run.tar.gz" -C artifacts "$$(basename "$$run")"; \
	exit "$$status"

Run make simulator-snapshots on your Mac runner. In GitHub Actions, give the upload step if: always() and point it at artifacts/simulator.*.tar.gz. Review current.png and diff.png before accepting any change. To replace a baseline, copy the reviewed current.png into the correct device and runtime folder and commit it with the change that caused the difference. A check with no baseline fails until someone approves one. GitHub's workflow artifact guide

How do I attach a checkpoint screenshot in XCTest?

Record the screenshot before the assertion, so the result bundle has an image when the assertion fails. Use this in an iOS UI test for a screen that is ready only after interaction, and replace the element identifiers with the ones from your app.

import XCTest

final class CheckoutScreenshotTests: XCTestCase {
    func testCheckoutLoads() {
        let app = XCUIApplication()
        app.launchArguments += ["-UITesting"]
        app.launch()
        app.buttons["open-checkout"].tap()

        let ready = app.otherElements["checkout-ready"].waitForExistence(timeout: 8)
        let screenshot = XCTAttachment(screenshot: app.screenshot())
        screenshot.name = "checkout-ready"
        screenshot.lifetime = .keepAlways
        add(screenshot)
        XCTAssertTrue(ready, "Checkout did not reach its ready state")
    }
}

Set a fresh -resultBundlePath when you run xcodebuild test, and upload that .xcresult even when the test fails. The attachment shows the state XCTest saw. The Makefile archive keeps the numeric comparison and the difference PNG. Apple's XCTest attachment API

Will the Intel Mac VM handle your screenshot matrix?

The Intel Mac VM ($25 a month, $2 a day) runs macOS Sequoia, where Apple lists Xcode 26.0 through 26.3, so it fits older runtimes and a small sequential matrix. It cannot run Xcode 26.4 or later, arm64-only binaries or visionOS. The Apple Silicon Mac VM ($39 a month, $6 a day, 4 shared vCPUs and 4GB RAM) fits current Xcode and a current simulator runtime. Xcode is not preinstalled, so plan for the download and the disk it needs, and check the macOS version shown before purchase against Apple's Xcode system requirements. We have not run these Simulator workloads on any plan, so time your own capture. See the Mac hosting plans.

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