CtrlK
BlogDocsLog inGet started
Tessl Logo

dpearson2699/swift-ios-skills

Agent skills for iOS, iPadOS, Swift, SwiftUI, and modern Apple framework development.

71

Quality

89%

Does it follow best practices?

Impact

No eval scenarios have been run

SecuritybySnyk

Advisory

Suggest reviewing before use

Overview
Quality
Evals
Security
Files

simctl-commands.mdskills/ios-simulator/references/

simctl Command Reference

Complete reference for xcrun simctl subcommands with syntax, flags, and examples. For workflows and patterns, see the main SKILL.md.

Contents

  • Device Management Commands
  • App Lifecycle Commands
  • Testing and Simulation Commands
  • Media and IO Commands
  • JSON Output Parsing
  • Privacy Service Names
  • Status Bar Override Flags
  • Troubleshooting

Device Management Commands

CommandSynopsisNotes
listsimctl list [devices|devicetypes|runtimes|pairs] [search-term]Add -j for JSON. Add available to filter to usable devices.
createsimctl create <name> <device-type-id> [<runtime-id>]Returns the new UDID. Omitting runtime selects the newest compatible one.
clonesimctl clone <UDID> <new-name>Copies device state including installed apps.
deletesimctl delete <UDID|unavailable|all>unavailable removes devices whose runtime is missing.
renamesimctl rename <UDID> <new-name>
erasesimctl erase <UDID|all>Factory reset — wipes apps and data, keeps the device.
bootsimctl boot <UDID>Starts the device runtime.
shutdownsimctl shutdown <UDID|all>Stops the device runtime.
upgradesimctl upgrade <UDID> <runtime-id>Upgrades device to a newer runtime.
pairsimctl pair <watch-UDID> <phone-UDID>Pairs a watchOS simulator with an iOS simulator.
unpairsimctl unpair <pair-UDID>Removes a watch/phone pairing.

Device Type and Runtime IDs

# List all device types — use the identifier column
xcrun simctl list devicetypes

# Example output line:
# iPhone 16 Pro (com.apple.CoreSimulator.SimDeviceType.iPhone-16-Pro)

# List all runtimes
xcrun simctl list runtimes

# Example output line:
# iOS 18.4 - com.apple.CoreSimulator.SimRuntime.iOS-18-4

Use the identifier strings (e.g., com.apple.CoreSimulator.SimDeviceType.iPhone-16-Pro) in create and upgrade commands.

App Lifecycle Commands

CommandSynopsisNotes
installsimctl install <UDID> <path-to-.app>Device must be booted. Path is a .app directory, not .ipa.
uninstallsimctl uninstall <UDID> <bundle-id>Removes app and its data.
launchsimctl launch [--console] [--terminate-running-process] <UDID> <bundle-id> [args...]--console streams stdout/stderr. --terminate-running-process kills existing instance first.
terminatesimctl terminate <UDID> <bundle-id>Sends SIGTERM to the running app.
spawnsimctl spawn <UDID> <path-to-binary> [args...]Runs an arbitrary binary inside the simulator. Used for log stream.
get_app_containersimctl get_app_container <UDID> <bundle-id> [app|data|groups|<group-id>]Returns the filesystem path to the container. groups lists all App Group containers.
appinfosimctl appinfo <UDID> <bundle-id>Prints Info.plist-derived information as JSON.

Launch Arguments and Environment

# Pass launch arguments (received as CommandLine.arguments)
xcrun simctl launch booted com.example.MyApp --reset-onboarding --debug-mode

# Override language and locale
xcrun simctl launch booted com.example.MyApp -AppleLanguages "(ja)" -AppleLocale "ja_JP"

# Set environment variables via spawn
xcrun simctl spawn booted env MY_VAR=value /path/to/MyApp.app/MyApp

Testing and Simulation Commands

CommandSynopsisNotes
pushsimctl push <UDID> <bundle-id> <payload.json|->Simulates local push delivery. Use - for stdin.
openurlsimctl openurl <UDID> <URL>Triggers universal links or custom URL schemes.
locationsimctl location <UDID> <set|clear|list|run|start> [args]set <lat,lon>, run <scenario>, list, start, or clear.
privacysimctl privacy <UDID> <grant|revoke|reset> <service> <bundle-id>See Privacy Service Names for service values.
keychainsimctl keychain <UDID> <add-root-cert|add-cert|reset> [cert-path]Manages trusted certificates in the simulator keychain.
status_barsimctl status_bar <UDID> <override|clear> [flags]See Status Bar Override Flags.

Push Payload Format

The JSON payload mirrors the APNs payload format. The Simulator Target Bundle key is optional — when provided, the bundle ID argument can be omitted:

{
    "Simulator Target Bundle": "com.example.MyApp",
    "aps": {
        "alert": {
            "title": "Order Update",
            "subtitle": "Order #1234",
            "body": "Your order has been shipped"
        },
        "badge": 1,
        "sound": "default",
        "category": "ORDER_STATUS",
        "thread-id": "order-1234",
        "interruption-level": "time-sensitive"
    },
    "orderID": "1234"
}

Location Scenarios

The run subcommand accepts predefined scenario names, not GPX file paths:

# List available predefined scenarios
xcrun simctl location booted list

# Run a predefined scenario
xcrun simctl location booted run "City Run"

# Set a fixed coordinate
xcrun simctl location booted set 37.3349,-122.0090

# Clear the simulated location
xcrun simctl location booted clear

Available scenarios include "City Run", "City Bicycle Ride", "Freeway Drive", and "Apple" (stationary at Apple Park). Use list to see all options on your system.

For custom routes using GPX files, use Xcode's Debug > Simulate Location menu instead of simctl location run.

Media and IO Commands

CommandSynopsisNotes
io screenshotsimctl io <UDID> screenshot [--type png|jpeg|tiff|bmp|gif] [--mask ignored|alpha|black] <path>Default type is png.
io recordVideosimctl io <UDID> recordVideo [--codec h264|hevc] [--mask ignored|alpha|black] [--force] <path>Ctrl+C to stop. --force overwrites existing files.
addmediasimctl addmedia <UDID> <path> [path...]Adds photos, live photos, videos, or contacts to the device. Supports PNG, JPEG, GIF, MOV, MP4, and vCard.

Mask Options

ValueEffect
ignoredNo mask applied (default). Full rectangular capture.
alphaTransparent pixels where the device bezel would be. Produces PNG with alpha channel. Not supported for video recording — falls back to black.
blackBlack pixels where the device bezel would be. Works with JPEG.

JSON Output Parsing

Find a Booted Device UDID

xcrun simctl list -j devices booted | \
    jq -r '[.devices[][] | select(.state == "Booted")] | first | .udid'

Find a Device by Name and Runtime

RUNTIME="com.apple.CoreSimulator.SimRuntime.iOS-18-4"
xcrun simctl list -j devices available | \
    jq -r --arg rt "$RUNTIME" \
    '.devices[$rt][] | select(.name == "iPhone 16 Pro") | .udid'

List All Available Runtimes

xcrun simctl list -j runtimes | \
    jq -r '.runtimes[] | select(.isAvailable == true) | "\(.name) — \(.identifier)"'

Get Device State

xcrun simctl list -j devices | \
    jq -r --arg udid "$UDID" \
    '[.devices[][] | select(.udid == $udid)] | first | .state'

Privacy Service Names

Service names accepted by simctl privacy grant|revoke|reset:

ServiceDescription
allAll services (reset only)
calendarEventKit calendar access
contacts-limitedLimited contacts access
contactsFull contacts access
locationWhen-in-use location access
location-alwaysAlways location access
photos-addAdd-only photo library access
photosFull photo library access
media-libraryApple Music / media library
microphoneMicrophone access
motionCore Motion activity data
remindersEventKit reminders access
siriSiri integration

Status Bar Override Flags

All flags for simctl status_bar <UDID> override:

FlagTypeExample
--timeString"9:41"
--dataNetworkStringhide, wifi, 3g, 4g, lte, lte-a, lte+, 5g, 5g+, 5g-uc, 5g-uwb
--wifiModeStringsearching, failed, active
--wifiBarsInteger03
--cellularModeStringnotSupported, searching, failed, active
--cellularBarsInteger04
--operatorNameString"" (empty for clean screenshots)
--batteryStateStringcharging, charged, discharging
--batteryLevelInteger0100

App Store Screenshot Preset

xcrun simctl status_bar booted override \
    --time "9:41" \
    --batteryState charged \
    --batteryLevel 100 \
    --cellularMode active \
    --cellularBars 4 \
    --wifiMode active \
    --wifiBars 3 \
    --dataNetwork wifi \
    --operatorName ""

Troubleshooting

Stuck "Booting" State

The device shows state "Booting" and simctl boot returns "Unable to boot device in current state: Booting."

# Step 1: force shutdown
xcrun simctl shutdown <UDID>

# Step 2: erase the device
xcrun simctl erase <UDID>

# Step 3: boot again
xcrun simctl boot <UDID>

If erasing does not resolve it, delete and recreate the device. As a last resort, clear the CoreSimulator caches:

xcrun simctl shutdown all
rm -rf ~/Library/Developer/CoreSimulator/Caches

Runtime Not Installed

simctl create or simctl boot fails with "Invalid runtime" or the runtime does not appear in simctl list runtimes.

# Check what's installed
xcrun simctl list runtimes

# Download a runtime via xcodebuild
xcodebuild -downloadPlatform iOS

# Or download via Xcode > Settings > Platforms

Runtime downloads can be large (5+ GB). In CI, pre-install runtimes in the base image.

CoreSimulator Cache Corruption

Symptoms: devices fail to boot, simctl list shows stale data, or "Unable to determine simulator device status."

# Nuclear option — reset everything
xcrun simctl shutdown all
xcrun simctl erase all
rm -rf ~/Library/Developer/CoreSimulator/Caches
# Restart CoreSimulatorService
launchctl kickstart -k gui/$(id -u)/com.apple.CoreSimulator.CoreSimulatorService 2>/dev/null || true

After clearing caches, you may need to re-create custom devices. Default devices are recreated automatically by Xcode.

"Unable to boot device in current state: Shutdown"

This usually means the required runtime is not fully installed or is corrupted. Verify the runtime is available and re-download if needed:

xcrun simctl list runtimes
# If the runtime shows (unavailable), re-download it
xcodebuild -downloadPlatform iOS

skills

ios-simulator

CHANGELOG.md

README.md

tile.json