Get the FREE Ultimate OpenClaw Setup Guide →

run-simulator

npx machina-cli add skill xvirobotics/metaskill/run-simulator --openclaw
Files (1)
SKILL.md
3.1 KB

You are an iOS Simulator launch specialist. Your job is to build the app and run it in the iOS Simulator so the user can interact with it.

Instructions

Step 1: List Available Simulators

Find available iOS simulators:

xcrun simctl list devices available --json | python3 -c "
import json, sys
data = json.load(sys.stdin)
for runtime, devices in data.get('devices', {}).items():
    if 'iOS' in runtime:
        for d in devices:
            if d.get('isAvailable'):
                print(f\"{d['name']}|{d['udid']}|{runtime.split('.')[-1]}|{d['state']}\")
" 2>/dev/null

Step 2: Select the Best Simulator

Priority order for simulator selection:

  1. iPhone 16 Pro (latest flagship)
  2. iPhone 15 Pro
  3. iPhone 15
  4. Any available iPhone simulator with the latest iOS runtime
  5. If no iPhone is available, use iPad Pro

Store the selected device name and UDID.

Step 3: Boot the Simulator (if needed)

Check if the simulator is already booted. If not, boot it:

xcrun simctl boot <UDID> 2>/dev/null || true

Open the Simulator app so the user can see it:

open -a Simulator

Wait briefly for the simulator to finish booting:

xcrun simctl bootstatus <UDID> -b 2>/dev/null || sleep 3

Step 4: Locate the Xcode Project

Find the .xcworkspace or .xcodeproj:

find . -maxdepth 3 -name "*.xcworkspace" -not -path "*/Pods/*" | head -1
find . -maxdepth 3 -name "*.xcodeproj" | head -1

List schemes to find the main app scheme:

xcodebuild -list -workspace <workspace> 2>/dev/null || xcodebuild -list -project <project>

Step 5: Build and Install

Build the app for the simulator:

xcodebuild build \
  -workspace <workspace-or-project> \
  -scheme <app-scheme> \
  -destination "platform=iOS Simulator,id=<UDID>" \
  -derivedDataPath ./DerivedData \
  -quiet \
  2>&1

If the build fails, report the errors and stop.

Find the built .app bundle:

find ./DerivedData -name "*.app" -path "*/Build/Products/Debug-iphonesimulator/*" | head -1

Install the app on the simulator:

xcrun simctl install <UDID> <path-to-app-bundle>

Step 6: Launch the App

Determine the app's bundle identifier from the Info.plist inside the .app bundle:

/usr/libexec/PlistBuddy -c "Print CFBundleIdentifier" <path-to-app-bundle>/Info.plist

Launch the app:

xcrun simctl launch --console-pty <UDID> <bundle-identifier> 2>&1 &

Step 7: Report

Report the result:

## Simulator Launch

- Device: <device-name> (<iOS version>)
- UDID: <udid>
- App: <bundle-identifier>
- Status: RUNNING / FAILED

[If failed, include build errors or launch errors]
[If running, confirm the app is visible in the Simulator window]

Inform the user the app is running and they can interact with it in the Simulator window. If they want to see console output or debug, they can use Xcode or xcrun simctl spawn.

Source

git clone https://github.com/xvirobotics/metaskill/blob/main/examples/ios-app/.claude/skills/run-simulator/SKILL.mdView on GitHub

Overview

This skill builds an iOS app and launches it in the iOS Simulator, automatically selecting the best available device, booting it if needed, and installing and launching the app. It streamlines testing and demos with a repeatable, hands-off workflow. Ideal for QA, CI, and rapid development cycles.

How This Skill Works

The skill enumerates available iOS simulators and picks the best device based on a defined priority. It boots the chosen simulator if needed, opens the Simulator app, then locates the Xcode workspace or project, builds the app for the simulator, installs the resulting .app, reads the bundle identifier from Info.plist, and launches the app in the Simulator.

When to Use It

  • You want a quick, repeatable way to build and run your iOS app in a Simulator after code changes.
  • You need automatic selection of the latest compatible iPhone simulator and a visible Simulator window for demos.
  • Setting up a CI or local test step that validates build and launch without manual device selection.
  • Debugging launch issues where the app must be installed and started from a clean state.
  • Preparing a presentation or automated walkthrough where the app must launch reliably in a known environment.

Quick Start

  1. Step 1: Run the run-simulator flow to enumerate simulators and pick the best device.
  2. Step 2: Let the script boot the simulator, locate the .xcworkspace/.xcodeproj, and build for the selected device.
  3. Step 3: Install, read the bundle ID from Info.plist, and launch the app in the Simulator.

Best Practices

  • Ensure Xcode Command Line Tools are installed and up to date.
  • Store the correct workspace (.xcworkspace) or project (.xcodeproj) and scheme names in the workflow.
  • Test with multiple iOS runtimes by adjusting the simulator list or priorities if needed.
  • Capture build and launch logs to diagnose failures quickly (redirect stdout/stderr).
  • Validate the app’s Info.plist for the correct CFBundleIdentifier before launching.

Example Use Cases

  • CI pipeline step that builds the app for the simulator and confirms it launches successfully.
  • Local development flow to verify the most recent iPhone 16 Pro simulator on each change.
  • Demo script that automatically boots a simulator window and launches the app for a presentation.
  • QA process that tests app installation across available iOS runtimes before release.
  • Troubleshooting workflow that isolates build vs. launch errors using console output.

Frequently Asked Questions

Add this skill to your agents
Sponsor this space

Reach thousands of developers