Skip to main content
Built by Best ROI Media · First-Party IntegrationMITWave 4 · LiveBestRoiMedia/bestroi-game-tools

ios-xcb

Machine-wide atomic lock wrapper serializing parallel xcodebuild and simctl runs.

Lightweight POSIX shell wrapper that serializes concurrent xcodebuild, simulator, and device commands across parallel agents using an atomic directory lock with stale-PID cleanup.

View on GitHub ↗
Quick clonegit clone https://github.com/BestRoiMedia/bestroi-game-tools.git
GitHub repositoryBestRoiMedia/bestroi-game-tools
Module path_tools/ios/
LicenseMIT
Release waveWave 4
LanguagesShell (POSIX sh)

Why we built it

When multiple AI agents build or test different iOS games on the same Mac simultaneously, concurrent xcodebuild and simctl calls contend on DerivedData and simulator state. A single machine-wide lock prevents those collisions.

Architecture & how it works

xcb.sh attempts an atomic mkdir at $XCB_LOCK (defaulting to /tmp/games_xcb.lock), records the owner PID and command, clears stale locks if the owner process no longer exists, and releases the lock on EXIT, INT, or TERM while returning the wrapped command's exact exit code.

Key capabilities

  • Atomic mkdir-based locking across all projects and parallel agents on one Mac
  • Automatic stale-lock detection and cleanup when an owner PID exits
  • Optional XCB_WAIT_LOG=1 diagnostics showing the active lock holder and command
  • Transparent exit-code passthrough and signal-safe cleanup traps

Usage example

Serialize an xcodebuild or simctl command across parallel agentsShell (POSIX sh)
./ios/xcb.sh xcodebuild -project ./ios/App.xcodeproj -scheme App build
XCB_WAIT_LOG=1 ./ios/xcb.sh xcrun simctl boot "iPhone 17 Pro"
Override the lock path with XCB_LOCK=/tmp/custom_xcb.lock if needed.