--- id: EvanBacon/serve-sim/serve-sim version: "c0638992" license: Apache-2.0 install: manual updated: 2026-07-17 --- # serve-sim — serve-sim exposes your Apple Simulator as a controllable web interface, making it accessible to AI coding agents and automation tools. Stream the simulator's display as MJPEG and send interactions back via WebSocket—perfect for local development, LAN sharing, or remote Mac setups with tunneling. Publisher: EvanBacon · Stars: 2602 · Updated: 2026-07-17 Install (manual): `git clone https://github.com/EvanBacon/serve-sim` ## Decision gist - What it does: serve-sim enables agent-driven control of your iOS, iPad, and Watch simulators through a CLI interface and WebSocket protocol. You can programmatically tap, swipe, rotate the device, and inject synthetic inputs—making it ideal for AI coding agents and automation workflows that need to interact with simulator UI elements. - Install: `npx skillfed install EvanBacon/serve-sim/serve-sim` · manual: `git clone https://github.com/EvanBacon/serve-sim` → `cp -r serve-sim/skills/serve-sim ~/.claude/skills/serve-sim` - Use it when: serve-sim streams your simulator's framebuffer as MJPEG directly to a web interface over WebSocket. - Use it when: Yes. - Similar skills: CharlesWiltgen/Axiom/axiom-test-simulator, EvanBacon/serve-sim/serve-sim-placeholder-assets, dpearson2699/swift-ios-skills/ios-simulator, Prisma-Labs-Dev/apple-skills/simulator-utils, vasilyu1983/AI-Agents-public/qa-testing-ios - Verify: Read SKILL.md below before installing ## SKILL.md # serve-sim Drive an Apple Simulator (iOS, iPad, Apple Watch) from an agent using the [serve-sim](https://github.com/EvanBacon/serve-sim) CLI. serve-sim spawns a Swift helper that captures the simulator framebuffer via `simctl io`, exposes it as an MJPEG stream plus a binary WebSocket input channel, and serves a React preview UI on top. This skill teaches an agent the exact CLI surface, the gesture JSON shape, the gotchas, and the recommended workflows. ## When to use - The user wants an agent to **tap, swipe, drag, pinch, or send hardware buttons** to a running Apple Simulator. - The user wants to **stream a simulator** to a browser (local, LAN, or tunneled) for review or remote control. - The user wants to **inject a synthetic camera feed** (file, webcam, or animated placeholder) into a specific app on the simulator. - The user wants to **toggle CoreAnimation debug overlays** (off-screen rendering, blended layers, slow animations) for performance work. - The user wants to **simulate a memory warning** or **rotate the device** programmatically. - The user wants to **read the simulator's accessibility tree** to find UI elements without pixel hunting. - The user wants to **grant, revoke, or reset an app's privacy permissions** — camera, photos, location, contacts, or **push notifications**. ## When NOT to use - Android emulators → use `adb shell` tooling. - Building or installing an iOS app → use `xcodebuild` or `xcrun simctl install`. - React Native in-app runtime debugging (Redux state, network inspection, component tree) → use rn-debugger tooling. - Real iOS hardware devices → use `xcrun devicectl` or Xcode. ## Prerequisites Before any other action, verify the host satisfies these. If something is missing, tell the user exactly what to install — do not proceed. | Requirement | Check command | Why | |---|---|---| | macOS host | `uname -s` returns `Darwin` | serve-sim only runs on macOS | | Xcode CLI tools | `xcrun --version` exits 0 | `simctl` is the underlying simulator driver | | Node.js ≥18 | `node --version` ≥18 | serve-sim is an npm package run via `npx` | | macOS 14+ (optional) | `sw_vers -productVersion` ≥14 | Required ONLY for `camera` subcommand | A bundled helper script is available: `scripts/check-prereqs.sh`. Run it; if it exits non-zero, surface the message to the user. A booted simulator is required for most subcommands. Check with `xcrun simctl list devices booted`. If none are booted, tell the user to open Xcode → Simulator or to run `xcrun simctl boot `. ## Mental model ```text ┌──────────────┐ simctl io ┌─────────────────┐ MJPEG / WS ┌─────────┐ │ iOS Simulator│ ──────────► │ serve-sim-bin │ ───────────► │ Browser │ └──────────────┘ (Swift) │ (per-device) │ └─────────┘ └─────────────────┘ ▲ state file in $TMPDIR/serve-sim/ ▲ ┌──────────────────┐ │ serve-sim CLI │ └──────────────────┘ ``` Key invariants the agent must respect: - **All coordinates are normalized 0..1**, with `(0, 0)` at top-left and `(1, 1)` at bottom-right of the display. Never pass pixel coordinates. - **One helper per device**. Multiple booted simulators are supported by passing several device names or by attaching to all. - **State lives in `$TMPDIR/serve-sim/server-{udid}.json`**. Use `serve-sim --list` to query it; do not read the JSON directly unless you know what you are doing. - **The orientation set via `rotate` is remembered by the helper**, and subsequent gestures are rotated client-side. An agent that sends raw coords after a rotation does not need to compensate manually. ## Common operations | Goal | Command | Notes | |---|---|---| | Start preview server | `npx serve-sim [device]` | Default preview at `http://localhost:3200`, stream at `:3100`. Foreground process. | | Start headless / daemon | `npx serve-sim --detach [device]` | Returns JSON with `pid`, `port`, `url`. Use for agent loops. | | Show stream in host's preview | `npx serve-sim --detach -q` → hand off `url` to host preview tool | See "Showing the stream in your agent's preview" section. | | List running streams | `npx serve-sim --list` | Add `-q` for JSON-only output. | | Stop all helpers | `npx serve-sim --kill` | Pass `[device]` to stop a specific one. | | Single tap | `npx serve-sim tap ` | ` ` in `0..1`. **Use this, not `gesture`, for plain taps.** See "Critical gotcha" below. | | Multi-step gesture | `npx serve-sim gesture ''` | See [references/gestures.md](references/gestures.md). | | Hardware button | `npx serve-sim button ` | Names: `home`, `swipe_home`, `app_switcher`, `lock`, `siri`, `side_button`. See [references/buttons-rotation.md](references/buttons-rotation.md). | | Rotate device | `npx serve-sim rotate ` | `portrait`, `portrait_upside_down`, `landscape_left`, `landscape_right`. | | Simulate memory warning | `npx serve-sim memory-warning` | Equivalent to Debug → Simulate Memory Warning. | | CoreAnimation debug | `npx serve-sim ca-debug