Run App on Simulator
Build and launch the app on an iOS Simulator.
Workflow
1. Build the App
xcodebuild -scheme MyApp \
-destination 'platform=iOS Simulator,name=iPhone 15' \
-derivedDataPath build \
build
2. Boot Simulator (if needed)
# List available simulators
xcrun simctl list devices
# Boot a specific simulator
xcrun simctl boot "iPhone 15"
3. Install App
xcrun simctl install "iPhone 15" \
build/Build/Products/Debug-iphonesimulator/MyApp.app
4. Launch App
xcrun simctl launch "iPhone 15" com.mycompany.MyApp
Combined Command
# Open simulator and run
open -a Simulator && \
xcodebuild -scheme MyApp \
-destination 'platform=iOS Simulator,name=iPhone 15' \
-derivedDataPath build \
build && \
xcrun simctl install booted build/Build/Products/Debug-iphonesimulator/MyApp.app && \
xcrun simctl launch booted com.mycompany.MyApp
Useful Simulator Commands
Take Screenshot
xcrun simctl io booted screenshot screenshot.png
Record Video
xcrun simctl io booted recordVideo video.mp4
Open URL
xcrun simctl openurl booted "myapp://deep-link"
Clear App Data
xcrun simctl uninstall booted com.mycompany.MyApp
Reset Simulator
xcrun simctl erase "iPhone 15"