| name | simulator-utils |
| user-invocable | true |
| description | iOS Simulator utility commands for screenshots, resizing, and common operations. Use these commands when taking simulator screenshots, resizing images for API compatibility, or performing common simulator operations. |
Simulator Utilities
Quick reference for iOS Simulator commands. Use these patterns whenever working with simulators.
Screenshot with Auto-Resize (REQUIRED)
ALWAYS use this pattern when taking screenshots to avoid API errors:
xcrun simctl io booted screenshot /path/to/screenshot.png && sips --resampleHeightWidthMax 1800 /path/to/screenshot.png
Why Resize?
- iPhone 17 simulator screenshots exceed 2000px
- Claude API rejects images >2000px in multi-image requests
sips --resampleHeightWidthMax 1800 keeps images under limit
Resize Existing Screenshots
sips --resampleHeightWidthMax 1800 /path/to/screenshot.png
sips --resampleHeightWidthMax 1800 /path/to/*.png
for f in /path/to/dir/*.png; do sips --resampleHeightWidthMax 1800 "$f"; done
Common Simulator Commands
Device Management
xcrun simctl list devices available
xcrun simctl boot "iPhone 17"
xcrun simctl shutdown booted
xcrun simctl erase "iPhone 17"
xcrun simctl list devices | grep Booted
App Operations
xcrun simctl install booted /path/to/App.app
xcrun simctl launch booted com.bundle.identifier
xcrun simctl terminate booted com.bundle.identifier
xcrun simctl uninstall booted com.bundle.identifier
Screenshots
xcrun simctl io booted screenshot /path/to/screenshot.png
xcrun simctl io booted screenshot /path/to/screenshot.png && sips --resampleHeightWidthMax 1800 /path/to/screenshot.png
xcrun simctl io booted screenshot - | pbcopy
Video Recording
xcrun simctl io booted recordVideo /path/to/video.mov
Build Commands
xcodebuild -scheme SCHEME -project /path/to/Project.xcodeproj -destination 'platform=iOS Simulator,name=iPhone 17' build
xcodebuild -scheme SCHEME -project /path/to/Project.xcodeproj -destination 'platform=iOS Simulator,name=iPhone 17' build 2>&1 | grep -E "(error:|warning:|BUILD)"
find ~/Library/Developer/Xcode/DerivedData -name "*.app" -path "*/Debug-iphonesimulator/*" -type d 2>/dev/null | head -1
Full Test Workflow
Complete pattern for build, install, launch, screenshot:
xcodebuild -scheme SCHEME -project /path/to/Project.xcodeproj -destination 'platform=iOS Simulator,name=iPhone 17' build 2>&1 | grep -E "(error:|BUILD)"
xcrun simctl terminate booted com.bundle.identifier 2>/dev/null
xcrun simctl install booted "/path/to/App.app"
xcrun simctl launch booted com.bundle.identifier
sleep 2
xcrun simctl io booted screenshot /path/to/screenshot.png && sips --resampleHeightWidthMax 1800 /path/to/screenshot.png
Image Manipulation with sips
sips (Scriptable Image Processing System) is macOS built-in:
sips --resampleHeightWidthMax 1800 image.png
sips --resampleWidth 1000 image.png
sips --resampleHeight 1000 image.png
sips -g pixelWidth -g pixelHeight image.png
sips -s format jpeg image.png --out image.jpg
sips --resampleHeightWidthMax 1800 *.png
Troubleshooting
"No devices are booted"
xcrun simctl boot "iPhone 17"
Screenshot too large for API
sips --resampleHeightWidthMax 1800 /path/to/screenshot.png
App won't launch
xcrun simctl listapps booted | grep -A5 "CFBundleIdentifier"
xcrun simctl uninstall booted com.bundle.identifier
xcrun simctl install booted /path/to/App.app
Simulator stuck
xcrun simctl shutdown all
xcrun simctl erase all
xcrun simctl boot "iPhone 17"