Loading...
Loading...
Builds and manages iOS/macOS apps using xcodebuild and xcrun simctl CLI tools. Use when working with Xcode projects, running apps in simulators, managing simulator instances, taking screenshots, capturing logs, running tests, or automating builds.
npx skill4agent add bradwindy/using-xcode-cli-skill using-xcode-clixcodebuildxcrun simctlswift packagexcrun simctl list devices availableUDID=$(xcrun simctl list devices --json | jq -r '.devices | .[].[] | select(.name=="iPhone 16 Pro" and .isAvailable==true) | .udid' | head -1)
xcodebuild -workspace App.xcworkspace -scheme App -destination "platform=iOS Simulator,id=$UDID" -derivedDataPath /tmp/build buildAPP_PATH=$(find /tmp/build -name "*.app" -type d | head -1)
xcrun simctl install $UDID "$APP_PATH"
xcrun simctl launch --console $UDID com.bundle.identifierxcrun simctl io $UDID screenshot /tmp/screenshot.png| Task | Command |
|---|---|
| List schemes | |
| List simulators | |
| Get simulator UDID | |
| Boot simulator | |
| Build for simulator | |
| Install app | |
| Launch app | |
| Take screenshot | |
| Run tests | |
| Stream logs | |
| Reference | Contents |
|---|---|
| xcodebuild.md | Project discovery, building, archiving, testing |
| simctl.md | Device management, screenshots, video, location, permissions |
| logging.md | Log streaming and filtering predicates |
| workflows.md | End-to-end automation scripts |
simctl list devices --jsonsimctl boot $UDIDxcodebuild-derivedDataPathsimctl installsimctl launch --consolexcodebuild -workspace App.xcworkspace -scheme App \
-destination "platform=iOS Simulator,id=$UDID" \
-only-testing "AppTests/SpecificTest" test| Mistake | Fix |
|---|---|
| "Unable to find destination" | Verify simulator exists with |
| "No scheme found" | Run |
| "App not found after build" | Use |
| Simulator not responding | Try |
| Build succeeds but app crashes | Check |
| Tests hang indefinitely | Add |
| Wrong simulator selected | Always use UDID from |
| Stale build artifacts | Use |