xcodebuildmcp is a unified command-line interface that provides both the MCP server and direct tool access. Use xcodebuildmcp mcp to start the MCP server, or invoke tools directly from your terminal.
# Install globally
npm install -g xcodebuildmcp
# Or run via npx
npx xcodebuildmcp --help# Start MCP server (for MCP clients like Claude, Cursor, etc.)
xcodebuildmcp mcp
# List available tools
xcodebuildmcp tools
# Build for simulator
xcodebuildmcp simulator build-sim --scheme MyApp --project-path ./MyApp.xcodeproj
# List simulators
xcodebuildmcp simulator list-sims
# Run tests
xcodebuildmcp simulator test-sim --scheme MyApp --simulator-name "iPhone 17 Pro"The CLI uses a per-workspace daemon architecture for stateful operations (log capture, video recording, debugging). Each workspace gets its own daemon instance.
- Workspace identity: The workspace root is determined by the location of
.xcodebuildmcp/config.yaml, or falls back to the current directory. - Socket location: Each daemon runs on a Unix socket at
~/.xcodebuildmcp/daemons/<workspace-key>/daemon.sock - Auto-start: The daemon starts automatically when you invoke a stateful tool - no manual setup required.
# Check daemon status for current workspace
xcodebuildmcp daemon status
# Manually start the daemon
xcodebuildmcp daemon start
# Stop the daemon
xcodebuildmcp daemon stop
# Restart the daemon
xcodebuildmcp daemon restart
# List all daemons across workspaces
xcodebuildmcp daemon list
# List in JSON format
xcodebuildmcp daemon list --jsonDaemon Status: Running
PID: 12345
Workspace: /Users/you/Projects/MyApp
Socket: /Users/you/.xcodebuildmcp/daemons/c5da0cbe19a7/daemon.sock
Started: 2024-01-15T10:30:00.000Z
Tools: 94
Workflows: (default)
Daemons:
[running] c5da0cbe19a7
Workspace: /Users/you/Projects/MyApp
PID: 12345
Started: 2024-01-15T10:30:00.000Z
Version: 1.15.0
[stale] a1b2c3d4e5f6
Workspace: /Users/you/Projects/OldProject
PID: 99999
Started: 2024-01-14T08:00:00.000Z
Version: 1.14.0
Total: 2 (1 running, 1 stale)
| Option | Description |
|---|---|
--socket <path> |
Override the daemon socket path (hidden) |
--daemon |
Force daemon execution for stateless tools (hidden) |
--no-daemon |
Disable daemon usage; stateful tools will fail |
-h, --help |
Show help |
-v, --version |
Show version |
Each tool supports --help for detailed options:
xcodebuildmcp simulator build-sim --helpCommon patterns:
# Pass options as flags
xcodebuildmcp simulator build-sim --scheme MyApp --project-path ./MyApp.xcodeproj
# Pass complex options as JSON
xcodebuildmcp simulatorbuild-sim --json '{"scheme": "MyApp", "projectPath": "./MyApp.xcodeproj"}'
# Control output format
xcodebuildmcp simulator list-sims --output jsonMost tools run directly without the daemon:
build-sim,test-sim,cleanlist-sims,list-schemes,discover-projsboot-sim,install-app-sim,launch-app-sim
Some tools maintain state and route through the daemon:
- Log capture:
start-sim-log-cap,stop-sim-log-cap - Video recording:
record-sim-video - Debugging:
debug-attach-sim,debug-continue, etc. - Background processes:
swift-package-run,swift-package-stop
When you invoke a stateful tool, the daemon auto-starts if needed.
If you want to disable daemon auto-start (stateful tools will error):
xcodebuildmcp build-sim --no-daemon --scheme MyAppThis is useful for CI environments or when you want explicit control.
The CLI respects the same configuration as the MCP server:
# .xcodebuildmcp/config.yaml
sessionDefaults:
scheme: MyApp
projectPath: ./MyApp.xcodeproj
simulatorName: iPhone 17 Pro
enabledWorkflows:
- simulator
- project-discoverySee CONFIGURATION.md for the full schema.
| Variable | Description |
|---|---|
XCODEBUILDMCP_SOCKET |
Override socket path for all commands |
XCODEBUILDMCP_DISABLE_SESSION_DEFAULTS |
Disable session defaults |
# Discover projects
xcodebuildmcp simulatordiscover-projs
# List schemes
xcodebuildmcp simulatordiscover list-schemes --project-path ./MyApp.xcodeproj
# Build
xcodebuildmcp simulator build-sim --scheme MyApp --project-path ./MyApp.xcodeproj
# Boot simulator
xcodebuildmcp simulator boot-sim --simulator-name "iPhone 17 Pro"
# Install and launch
xcodebuildmcp simulator install-app-sim --simulator-id <UDID> --app-path ./build/MyApp.app
xcodebuildmcp simulator launch-app-sim --simulator-id <UDID> --bundle-id com.example.MyApp# Start log capture (daemon auto-starts)
xcodebuildmcp logging start-sim-log-cap --simulator-id <UDID> --bundle-id com.example.MyApp
# ... use your app ...
# Stop and retrieve logs
xcodebuildmcp logging stop-sim-log-cap --session-id <SESSION_ID># Run all tests
xcodebuildmcp simulator test-sim --scheme MyAppTests --project-path ./MyApp.xcodeproj
# Run with specific simulator
xcodebuildmcp simulator test-sim --scheme MyAppTests --simulator-name "iPhone 17 Pro"| Feature | CLI (xcodebuildmcp <tool>) |
MCP (xcodebuildmcp mcp) |
|---|---|---|
| Invocation | Direct terminal | MCP client (Claude, etc.) |
| Session state | Per-workspace daemon | In-process |
| Use case | Scripts, CI, manual | AI-assisted development |
| Configuration | Same config.yaml | Same config.yaml |
Both share the same underlying tool implementations.
# Check for stale sockets
xcodebuildmcp daemon list
# Force restart
xcodebuildmcp daemon restart
# Run in foreground to see logs
xcodebuildmcp daemon start --foregroundIncrease the daemon startup timeout:
# Default is 5 seconds
export XCODEBUILDMCP_STARTUP_TIMEOUT_MS=10000The socket directory (~/.xcodebuildmcp/daemons/) should have mode 0700. If you encounter permission issues:
chmod 700 ~/.xcodebuildmcp
chmod -R 700 ~/.xcodebuildmcp/daemons