Skip to content
xcloom
EN/中文

70% of iOS Sessions Wait on Xcode

By Jin Li (@jinfizz / github.com/kiyoakii) | 2026-11-24

When I started running Claude Code across my production iOS and watchOS app (77.7 MB .ipa, 140.5 MB unpacked .app, 7 nested bundles), the sessions felt slow even on an Apple Silicon Mac. I assumed model latency was the bottleneck. Pulling the raw session transcripts proved the opposite: across 317.4 min of recorded engineering work, the model spent 95.2 min (30%) thinking and 222.2 min (70%) blocked on local Xcode, simulator, and upload tools.

Every minute spent waiting on a serial xcodebuild lock or a 140.5 MB simulator reinstall stalls the feedback loop between edits. I built XCLoom as a Fair Source (FSL-1.1-ALv2, converting to Apache-2.0 after 2 years; Agent Skills Apache-2.0) local CLI to remove those local waits at each layer of the iOS build, simulator, signing, and upload stack.

What the Session Transcripts Measured

I audited two full-length Claude Code sessions (Session A and Session B) from this production app, splitting wall-clock time into LLM generation versus local tool execution.

MetricSession ASession BCombined
Total wall-clock duration
208.2 min
109.2 min
317.4 min
LLM thinking time
61.1 min (29%)
34.1 min (31%)
95.2 min (30%)
Local tool wait time
147.1 min (71%)
75.1 min (69%)
222.2 min (70%)
UI driver runs
84.1 min (53 runs, avg 95s, max 611s)
41.6 min (17 runs, avg 147s, max 648s)
125.7 min (70 runs)
Build + drive runs
45.5 min (9 runs, max 968s)
26.5 min (5 runs, max 607s)
72.0 min (14 runs)
Build script invocations
9.4 min (10 runs, max 233s)
3.7 min (7 runs, max 78s)
13.1 min (17 runs)
Other local tools
8.1 min
3.3 min
11.4 min

In a separate UI regression log, 19 simulator UI verification runs consumed 25 min on their own.

Shipping builds showed the same pattern. Across a 5-build TestFlight baseline (8.8–11.1 min end-to-end), local machine time took 4.0–7.1 min per release before Apple server processing added another 3–5 min:

  • xcodebuild archive: 128–155s in normal runs, spiking to 284s when adding .treatWarning(..., as: .error) in Package.swift dropped cache hits to 0/3419 (invalidating all 3,419 cached tasks).
  • xcodebuild -exportArchive: 40–49s.
  • altool upload (used by the baseline release pipeline): 67–118s.
  • Apple server processing: 3–5 min.

Four Concrete Root Causes in the Logs

Tracing the slowest tool calls exposed four mechanical bottlenecks inside the default toolchain workflow.

1. Reinstalling 140.5 MB per UI state

To reset app state between UI checks, the verification harness ran a full simctl uninstall followed by simctl install of the 140.5 MB unpacked .app bundle with all 7 nested bundles. Copying and re-registering 140.5 MB through CoreSimulator dominated the 84.1 min and 41.6 min UI driver buckets even when the binary had changed by a single Swift expression.

2. Short-lived accessibility polling and 30-second timeouts

The UI driver polled the simulator accessibility tree in 0.3s loops with 30s selector timeouts. Whenever a view hierarchy shifted or a screen rendered an unexpected state, a single check sat idle for 30s before reporting failure, pushing individual runs to 611s and 648s.

3. Serial xcodebuild queue locks and path-coupled DerivedData

My legacy build script serialized xcodebuild behind a single queue lock to avoid DerivedData corruption. Across recorded runs, its real wall-clock range was 32–233s (including queue lock contention and cache invalidation), and spinning up a second git worktree for a parallel agent forced a cold rebuild because Xcode bakes absolute worktree and DerivedData paths into its dependency tracking.

4. Stock simulator concurrency limits

A stock iOS Simulator boots dozens of background daemons (CloudKit, Spotlight, News, Weather, Tips, and system telemetry) that unit tests and UI verification never call. Booting multiple stock simulators for parallel worktrees drives host memory pressure and triggers CoreSimulator boot storms, forcing agents to serialize onto one simulator instance.

How XCLoom Addresses Each Layer

I structured XCLoom into four independent CLI layers that you can adopt incrementally without rewriting your Xcode project.

Layer 1: Shared Worktree-Independent Local CAS

zsh
xcloom build --local --json
xcloom build --local --engine xcodebuild --explain-cache
xcloom cache-why MyApp --repo . --json

XCLoom uses two separate local CAS mechanisms depending on the build engine:

  • The xcodebuild worktree-cache path runs a local Unix-socket LLVM CAS plugin with path-normalized worktree and DerivedData prefixes so parallel git worktree checkouts compiling the same Swift source produce identical cache keys.
  • The --engine direct path uses a file-backed APFS clonefile(2) direct CAS (~/.cache/xcloom/direct-cas) keyed by relative content digests, with optional BYO-bucket L2 Remote CAS (--remote-cas pointing to S3, Cloudflare R2, or a shared filesystem) to share compiled artifacts across Macs and CI without a vendor account or hosted build service.

With --engine auto (the local macOS Debug default for build, run, hot, and test), the direct engine compiles eligible .xcodeproj, .xcworkspace, CocoaPods, and XcodeGen (project.yml) apps using native compiler rules (Swift, C/C++/ObjC, SwiftPM dependencies, .xcassets, Storyboards/XIBs, Metal, CoreData momc, and Swift Macros) plus per-target hybrid delegation for rare unsupported dependency targets, skipping full xcodebuild graph replanning. Standalone Package.swift apps and unsupported custom rules fall back automatically to xcodebuild and print engine_fallback_reason. Local Release builds and xcloom archive --local default to xcodebuild under --engine auto and support explicit --engine direct (xcloom archive --local --engine direct), while xcloom testflight builds via xcodebuild (for a direct-engine release flow, pair xcloom archive --local --engine direct with xcloom preflight and xcloom upload-asc). Use --explain-cache (run with --engine xcodebuild and without --json) and xcloom cache-why to diagnose xcodebuild and fallback cache misses; direct-engine builds report per-target cas_hits / cas_misses directly.

Standalone XCLoom Direct timings on this modular production app (77.7 MB .ipa, 7 nested bundles; listed standalone without comparing against the queue-locked legacy script, with clean like-for-like public OSS baselines below):

  • 1-file Swift edit (simulator): 2.41s (118/2 CAS hits/misses).
  • Fresh git worktree build: 1.32s (124/0 CAS hits/misses).
  • Release 1-file archive (--adhoc-inspect archive_seconds): 20.3s (cold archive: 124.0s; 23.1s / 126.7s total with .ipa export; signed release run pending physical-iPhone verification).

Measured 3-round medians on public open-source apple/sample-food-truck (scripts/bench/direct-engine-food-truck.sh, v0.10.0 pre-release revision 377babb, logged in docs/claims-ledger.md, 2026-11-20):

  • Cold build: 26.41s vs 22.61s native xcodebuild (measured before parallel xcloom-car asset compilation landed in v0.10.0 pre-release revision 3c39d3c, which dropped cold build to 7.78s vs 23.90s in the 6-repo suite below).
  • Fresh worktree: 22.82s -> 0.25s.
  • 1-line Swift edit: 3.81s -> 1.02s.
  • No-op rebuild: 2.44s -> 0.06s.

Across the 6-repository unified open-source harness (scripts/bench/direct-engine-large-oss.sh --preset all --rounds 3, v0.10.0 pre-release revision 3c39d3c, logged in docs/claims-ledger.md, measured 2026-11-24), all 6 repositories compile via direct (fallback_reason=-) and beat xcodebuild in all 24/24 cells, which still holds when recomputed against the earlier quiet baseline revision 89bba10 (also logged in docs/claims-ledger.md). Restricting headline ratios to cells with stable native baselines (<= 15% variance vs that 89bba10 quiet baseline):

  • Cold builds (Scenario A, 5 stable repos, 1.11x–3.07x): apple/sample-food-truck 23.90s -> 7.78s (3.07x), Dimillian/IceCubesApp 45.68s -> 26.85s (1.70x), Ranchero-Software/NetNewsWire 23.22s -> 14.27s (1.63x), jellyfin/Swiftfin 70.55s -> 56.65s (1.25x), and signalapp/Signal-iOS 76.70s -> 69.02s (1.11x).
  • Fresh worktrees (Scenario C, 5 stable repos, 3.96x–51.5x): apple/sample-food-truck 23.16s -> 0.45s (51.5x), Dimillian/IceCubesApp 45.97s -> 1.00s (46.0x), jellyfin/Swiftfin 58.70s -> 3.03s (19.4x), signalapp/Signal-iOS 74.10s -> 5.15s (14.4x), and wikimedia/wikipedia-ios 47.36s -> 11.95s (3.96x).

See /benchmarks/ for the complete 24-cell table (including wikimedia/wikipedia-ios Cold A, Ranchero-Software/NetNewsWire Fresh Worktree C, and all 12 No-Change B and 1-Line Edit D cells), raw min–max ranges, and host load logs.

Layer 2: Warm .dylib Patching and Single-RunLoop Matrix Checks

zsh
# Requires hot-index.json from a prior `xcloom build --local`
xcloom hot --repo . --json

# Standalone 4-state UI audit (leases App-Aware slim sim, injects probe, captures 2x2 PNG, shuts down on exit)
# Defaults to light, dark, compact, dark-ax-xxxl; pass --states light,compact,dark-ax-xxxl,rtl for RTL
xcloom matrix --repo . --json

# Same 4-state probe on an already-booted simulator launched with libxcloom_matrix_probe.dylib
# Defaults to Light, 375pt Compact, Dark + AX-XXXL, RTL
xcloom canvas matrix-act --udid <BOOTED_SIM_UDID> --bundle-id com.example.app --json

When an edit changes a function or SwiftUI body without altering stored type layouts, XCLoom compiles only the changed unit into a small .dylib and injects it into the running app without reinstalling the .app bundle. For visual checks, xcloom matrix runs standalone end to end: it leases an App-Aware slim simulator, injects libxcloom_matrix_probe.dylib, captures a 2x2 PNG across light, dark, compact, dark-ax-xxxl by default (pass --states light,compact,dark-ax-xxxl,rtl for RTL), and shuts down cleanly on exit. On an already-booted instrumented simulator, xcloom canvas matrix-act runs the same single-RunLoop 4-state probe (Light, 375pt Compact, Dark + AX-XXXL, RTL by default) and red-boxes both UILabel text truncation and view-tree viewport overflow clipping.

  • Production iOS app warm .dylib patch: 0.36s (63 KB patch instead of reinstalling 140.5 MB).
  • apple/sample-food-truck warm .dylib patch: 0.37s.
  • Single-RunLoop 2x2 red-box layout check (xcloom canvas matrix-act on a pre-booted slim iPhone 17, excluding boot and first launch): 1.44s (1441.4 ms CLI 3-round median / 1468.6 ms probe median on the full SwiftUI + Swift Charts apple/sample-food-truck app; 0.064s / 63 ms probe median on the minimal UIKit MatrixSweepOracle fixture, 0 leaked simulators).

This removes both the simctl uninstall/install penalty and the 0.3s polling loop for layout and state checks.

Layer 3: Built-In Slim Simulator Pool

zsh
xcloom sim lease --ttl-secs 900 --json
xcloom sim status
xcloom sim lease --release <udid>

XCLoom includes a built-in slim simulator pool with no external simslim dependency. Before booting a simulator, XCLoom applies a dual-tier categorized disabled.plist policy organized into 19 daemon categories (147 default-disabled / 160 total categorized) while keeping 24 critical daemons always protected: com.apple.assistantd (disabling it triggers Spotlight memory leaks), com.apple.gamed (disabling it stalls XCUITest DTServiceHub launches), and com.apple.coredevice.dtuhidd (needed for CoreSimulator host bridging and HID control, including iPhone Duo). Passing --stock restores the exact original disabled.plist bytes. The +0.53–0.57s cold boot delta reflects pre-boot disabled.plist backup and merge plus launchd_sim startup adjustment when 147–160 services are masked. The pool enforces hardware-adaptive concurrency caps (2 slim slots on 16 GB Macs up to 12 on 128 GB+ Mac Studio), throttles concurrent cold boots (default 2 slim or 1 stock boot, with opt-in queuing via --wait-secs) to prevent CoreSimulator boot storms, and uses owner-PID + TTL lease tracking with automatic background reaping so crashed agent runs do not leave orphaned simulators behind, without touching simulators booted outside XCLoom.

  • Safe Default (default xcloom sim boot, 147 disabled entries; keeps widgets, store, and photos enabled; pass --stock to opt out): ri_phys_footprint 1.88 GiB -> 1.50 GiB (-20.3%, -0.38 GiB), launchd_sim processes 213 -> 140 (-34.3%), cold boot wall time 2.37s -> 2.94s (+0.57s).
  • App-Aware Auto-Slim (xcloom sim boot --for <App.app | .>, auto-enabled in xcloom run --smoke, xcloom matrix, and xcloom test; static entitlement, Info.plist, .appex, and LC_LOAD_DYLIB analysis in 2–15 ms, disabling unused widgets, store, and photos up to 160 entries): measured on MinimalApp.app, ri_phys_footprint 1.70 GiB -> 0.72 GiB (-57.3%; unrounded 1.695 -> 0.724 GiB, -0.97 GiB), launchd_sim processes 190 -> 85 (-55.3%), cold boot wall time 2.49s -> 3.02s (+0.53s).

You can estimate safe concurrency for your machine's RAM on /tools/simulator-ram-calculator/.

Layer 4: Keychain-Free Signing, Offline Preflight, and Direct Upload

zsh
# Interactive one-time import of your Development signing identity
xcloom sign import-keychain --team-id <TEAM_ID>
# Dedicated release host only (adds Apple Distribution):
# xcloom sign import-keychain --team-id <TEAM_ID> --include-distribution

# Local Release archive, offline preflight, and chunked ASC upload
# upload-asc reads ~/.appstoreconnect or ASC_KEY_ID, ASC_ISSUER_ID, and ASC_PRIVATE_KEY_PATH / AuthKey_<ID>.p8
xcloom archive --local --engine direct --out ./Release.ipa --json
xcloom preflight ./Release.ipa --method app-store --json
xcloom upload-asc ./Release.ipa --bundle-id com.example.app --short-version 1.0 --build-number 1 --json

To eliminate background Keychain dialogs and late App Store rejections, XCLoom requires an interactive TTY to import your signing identity once into a 0700 Time-Machine-excluded team directory and computes CMS signatures directly in process. The store writes encrypted kc_<fp>.p12, a 0600 .p12.password, and kc_<fp>.cer, zeroizing secret buffers on drop. That protects against stray plaintext .key.pem files, Time Machine key leaks, other macOS user accounts, and headless Keychain exports without a TTY; it does not isolate against other unsandboxed processes running as the same macOS user (since the sibling .p12.password enables unattended signing). Development imports omit --include-distribution, while Distribution and Release imports require explicit --include-distribution opt-in (omitting it returns XCLOOM-SIGN-DISTRIBUTION-OPT-IN-REQUIRED):

  • Signing time: 0.43s self-signed CMS signing (9-run median, 85 MB / 27 bundles), verified with /usr/bin/codesign --verify --deep --strict, with zero background Keychain prompts. Full Apple Distribution signing with RFC 3161 TSA timestamping, physical iPhone install, and App Store Connect acceptance is not yet measured on a device; standard codesign and xcodebuild remain available anytime.
  • Offline preflight (xcloom preflight): 0.39s single trial on an 85 MB .ipa, 1.87s on the 77.7 MB production App Store .ipa, and 0.66s (--method development) to 3.11s (--method app-store) 9-run median on a 149 MB .ipa, checking 22 ITMS-* packaging and Privacy Manifest rules (including ITMS-91053 and ITMS-91056 PrivacyInfo.xcprivacy required-reason API checks) plus 9 XCLOOM-252-* Guideline 2.5.2 checks for leaked XCLoom dev-time hot-reload markers (31 total offline checks) before a single byte leaves the Mac.
  • Direct chunked upload (xcloom upload-asc): 25.1s in 15 chunks over a 16-stream HTTP/2 pool on the 77.7 MB .ipa (reading ~/.appstoreconnect credentials or ASC_KEY_ID, ASC_ISSUER_ID, and ASC_PRIVATE_KEY_PATH / AuthKey_<ID>.p8), compared to 67–118s with altool.
  • End-to-end delivery measurements pending verification: side-by-side .dev QR OTA install (not yet measured on a device), on-device .dylib hot reload (not yet measured on a device), and signed TestFlight local pipeline (not yet measured).

Fallback Boundaries

I designed XCLoom to be explicit about what it handles directly and where it falls back or stops:

  • Direct build scope and fallback: local Debug build, run, hot, and test default to direct under --engine auto for .xcodeproj, .xcworkspace, CocoaPods, and XcodeGen (project.yml) apps via native compiler rules and per-target hybrid delegation; standalone Package.swift apps, unsupported custom build rules, and Xcode-only build phases fall back to xcodebuild and emit an explicit engine_fallback_reason field in JSON output. Local Release builds and xcloom archive --local default to xcodebuild under --engine auto and support explicit --engine direct (xcloom archive --local --engine direct), while xcloom testflight builds via xcodebuild (pair xcloom archive --local --engine direct with xcloom preflight and xcloom upload-asc for a direct-engine release pipeline).
  • Hot-patch layout boundary: adding or reordering stored properties on a struct, class, or actor, or adding and deleting Swift source files, cannot be patched via .dylib. xcloom hot returns requires_full_rebuild: true so you run xcloom build --local, whereas xcloom dev --watch triggers the full incremental rebuild automatically.
  • Compiler flag invalidation: changing compiler flags (such as adding .treatWarning(..., as: .error) in Package.swift) changes the cache key and still invalidates affected compilation units. Run xcloom build --local --engine xcodebuild --explain-cache (without --json) or xcloom cache-why MyApp --repo . --json to diagnose xcodebuild and fallback cache misses; direct-engine builds report per-target cas_hits / cas_misses directly.
  • Preflight and App Review scope: xcloom preflight catches 22 structural and Privacy Manifest ITMS-* errors (including ITMS-91053 and ITMS-91056) plus 9 XCLOOM-252-* checks for leaked XCLoom dev-time hot-reload markers (31 total offline checks), but it does not statically prove absence of arbitrary third-party dlopen or interpreter code, and it cannot shorten Apple's 3–5 min server-side TestFlight processing window.

Where to Go Next

  • Inspect reproducible benchmark scripts and raw timings on /benchmarks/.
  • Size your parallel agent fleet with /tools/simulator-ram-calculator/.
  • Compare XCLoom against MobileBuildMCP, xcrun mcpbridge, Tuist, simslim, and fastlane on /vs/.
  • Troubleshoot common DerivedData locks, simulator OOMs, Keychain hangs, and ITMS-* rejections in /errors/.
A long chain of punched cards feeding an industrial Jacquard loom
Punch cards industrial loom. Sunfox, CC BY-SA 2.0, Wikimedia Commons.
zsh
# Install via Homebrew (or: curl -fsSL https://xcloom.dev/install.sh | sh, installs to ~/.local/bin)
brew install xcloom/tap/xcloom

# Read-only environment and simulator check (zero changes to your project)
xcloom doctor
xcloom sim status

# Wire MCP and Agent Skills into your coding agents (repo-local by default; add --global for user-wide; zero Node)
xcloom mcp install --claude --codex --cursor
xcloom skill install --claude --codex --cursor

Or paste one sentence into Claude Code, Codex, or Cursor so the agent installs the CLI, registers MCP and the agent skill, runs a first local build, and optionally installs git merge drivers or benchmarks your repo:

Open agent-setup.md
Read https://xcloom.dev/agent-setup.md and set up XCLoom for this repository: install the CLI, register the MCP server and agent skill, verify the environment with xcloom doctor, and run a first local build with xcloom build --local --json. Optionally install the git merge drivers and run xcloom bench --repo . --json (isolated cold xcodebuild comparison; can take several minutes on large repositories).

Requires macOS with local Xcode SDKs and compilers. Runs directly on existing .xcodeproj, .xcworkspace, CocoaPods, and XcodeGen projects without format migration; standalone Package.swift apps and unsupported build rules fall back automatically to xcodebuild.