/xcode:run [--scheme <name>] [--simulator <name>] [--device <name>] [--clean] [--configuration <Debug|Release>]from xcode
Builds and runs Xcode projects on iOS simulators or physical devices. Handles project discovery, scheme selection, and simulator booting.
Ships in xcode. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
You are a Claude Code slash command that builds and runs Xcode projects on simulators or physical devices. Follow the protocol below exactly, using only the allowed tools.
Parse the arguments provided to this command ($ARGUMENTS) and support these flags:
--scheme <name>: Specify the scheme to build (required if multiple schemes exist)--simulator <name>: Run on simulator matching this name (e.g., "iPhone 15 Pro", "iPad Pro")--device <name>: Run on physical device matching this name--clean: Perform clean build before running--configuration <config>: Build configuration (Debug or Release, default: Debug)Before starting, verify that Xcode command line tools are available:
xcodebuild -version
If not found, inform the user to install Xcode and command line tools.
Find the Xcode project or workspace in the current directory:
# Look for workspace first (preferred over project)
find . -maxdepth 2 -name "*.xcworkspace" -type d
# If no workspace, look for project
find . -maxdepth 2 -name "*.xcodeproj" -type d
Priority:
.xcworkspace if found (required for CocoaPods/SPM).xcodeproj--project flagStore the project type (-workspace or -project) and path for later use.
Get available schemes from the project:
# For workspace
xcodebuild -workspace <workspace-path> -list
# For project
xcodebuild -project <project-path> -list
Parse the output to extract:
Scheme selection:
--scheme flag provided, use that schemeDetermine the build destination based on flags:
# List available simulators
xcrun simctl list devices available --json
Parse JSON output to find:
--simulator name (partial match allowed)--simulator flag, use first available iPhone simulatorBoot simulator if needed:
xcrun simctl boot <device-udid>
Open Simulator.app:
open -a Simulator
Destination format:
-destination 'platform=iOS Simulator,id=<device-udid>'
# List connected devices
xcrun xctrace list devices
Parse output to find:
--device nameDestination format:
-destination 'platform=iOS,id=<device-udid>'
Error handling:
--device specified but no devices connected, report error--simulator name not found, report error with available simulators--simulator and --device specified, report error (mutually exclusive)If --clean flag is provided:
xcodebuild clean \
-workspace <workspace-path> \ # or -project
-scheme <scheme> \
-configuration <configuration>
Report clean status.
Execute the build command:
xcodebuild \
-workspace <workspace-path> \ # or -project
-scheme <scheme> \
-configuration <configuration> \
-destination <destination> \
build
Monitor build output:
On successful build, install and launch:
For simulator:
# The app should auto-launch after build
# If not, use:
xcrun simctl install <device-udid> <path-to-app>
xcrun simctl launch <device-udid> <bundle-id>
For physical device:
# Installation happens automatically via xcodebuild
# Use -destination with id to install and run
Print a summary:
Example output:
✓ Build succeeded
Project: MyApp.xcworkspace
Scheme: MyApp
Configuration: Debug
Destination: iPhone 15 Pro (Simulator)
Build time: 12.4s
Bundle ID: com.example.MyApp
App is running on iPhone 15 Pro simulator.
Common errors and solutions:
Error: No Xcode project or workspace found in current directory.
Please run this command from your Xcode project root.
Error: Multiple schemes found. Please specify one with --scheme flag.
Available schemes:
- MyApp
- MyAppTests
- MyAppUITests
Usage: /xcode:run --scheme MyApp
Error: Build failed
<extracted error messages>
Suggestion: Check the error above and fix compilation issues.
Error: No simulator found matching "iPhone 14 Pro"
Available simulators:
- iPhone 15 Pro
- iPhone 15
- iPad Pro (12.9-inch)
Usage: /xcode:run --simulator "iPhone 15 Pro"
Error: No physical devices connected.
Please connect an iOS device or use --simulator flag instead.
Error: Code signing failed
This usually means:
1. No valid provisioning profile
2. Team not set in project
3. Certificate not installed
Please open the project in Xcode and configure signing settings.
/xcode:run
Uses first available scheme, runs on first available simulator.
/xcode:run --simulator "iPhone 15 Pro"
/xcode:run --scheme MyApp --simulator "iPad Pro"
/xcode:run --device "My iPhone"
/xcode:run --clean --configuration Release --simulator "iPhone 15"
2>&1 to capture both stdout and stderr from xcodebuildWhat SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub setouchi-h/cc-marketplace --plugin xcodeOther plugins' skills for the same job