using-xcode-cli

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.

16 stars

Best use case

using-xcode-cli is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

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.

Teams using using-xcode-cli should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/using-xcode-cli/SKILL.md --create-dirs "https://raw.githubusercontent.com/diegosouzapw/awesome-omni-skill/main/skills/cli-automation/using-xcode-cli/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/using-xcode-cli/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How using-xcode-cli Compares

Feature / Agentusing-xcode-cliStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

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.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# Using Xcode CLI

## Overview

Native Xcode CLI tools (`xcodebuild` and `xcrun simctl`) provide full control over iOS/macOS builds and simulators without opening Xcode IDE. **Core principle:** Use CLI for automation, headless builds, and CI/CD—the same tools Xcode uses internally.

## When to Use

- Building iOS/macOS apps from command line
- Running apps in iOS Simulator programmatically
- Taking screenshots or recording video of simulator
- Running unit/UI tests with specific targeting
- Automating builds in CI/CD pipelines
- Managing simulator instances (boot, shutdown, erase)
- Simulating location, push notifications, or permissions
- Capturing app logs for debugging

**Symptoms that trigger this skill:**
- "Unable to find destination matching"
- "No scheme named X found"
- "xcodebuild: error:"
- Need to automate Xcode workflows
- Building without opening Xcode IDE

## When NOT to Use

- Editing code or project settings → Use Xcode IDE
- Managing Swift Package dependencies → Use `swift package` CLI
- Cross-platform builds → Use platform-specific tools
- Signing/provisioning profile management → Use Xcode or fastlane

## Quick Start

**Find available simulators:**
```bash
xcrun simctl list devices available
```

**Build for simulator:**
```bash
UDID=$(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 build
```

**Install and launch:**
```bash
APP_PATH=$(find /tmp/build -name "*.app" -type d | head -1)
xcrun simctl install $UDID "$APP_PATH"
xcrun simctl launch --console $UDID com.bundle.identifier
```

**Take screenshot:**
```bash
xcrun simctl io $UDID screenshot /tmp/screenshot.png
```

## Quick Reference

| Task | Command |
|------|---------|
| List schemes | `xcodebuild -workspace App.xcworkspace -list` |
| List simulators | `xcrun simctl list devices available` |
| Get simulator UDID | `xcrun simctl list devices --json \| jq ...` |
| Boot simulator | `xcrun simctl boot $UDID` |
| Build for simulator | `xcodebuild ... -destination "platform=iOS Simulator,id=$UDID" build` |
| Install app | `xcrun simctl install $UDID /path/to/App.app` |
| Launch app | `xcrun simctl launch --console $UDID com.bundle.id` |
| Take screenshot | `xcrun simctl io $UDID screenshot /tmp/shot.png` |
| Run tests | `xcodebuild ... test` |
| Stream logs | `/usr/bin/log stream --predicate 'processImagePath CONTAINS "App"'` |

## Reference Documentation

| Reference | Contents |
|-----------|----------|
| [xcodebuild.md](reference/xcodebuild.md) | Project discovery, building, archiving, testing |
| [simctl.md](reference/simctl.md) | Device management, screenshots, video, location, permissions |
| [logging.md](reference/logging.md) | Log streaming and filtering predicates |
| [workflows.md](reference/workflows.md) | End-to-end automation scripts |

## Common Patterns

### Build + Run
1. Find simulator UDID via `simctl list devices --json`
2. Boot simulator with `simctl boot $UDID`
3. Build with `xcodebuild` using `-derivedDataPath`
4. Find .app bundle in derived data
5. Install with `simctl install`
6. Launch with `simctl launch --console`

### Run Tests
```bash
xcodebuild -workspace App.xcworkspace -scheme App \
  -destination "platform=iOS Simulator,id=$UDID" \
  -only-testing "AppTests/SpecificTest" test
```

## Common Mistakes

| Mistake | Fix |
|---------|-----|
| "Unable to find destination" | Verify simulator exists with `simctl list devices`. Use exact name or UDID. |
| "No scheme found" | Run `xcodebuild -list` to see available schemes. Ensure you're using `-workspace` or `-project` flag. |
| "App not found after build" | Use `-derivedDataPath /tmp/build` and search there with `find`. |
| Simulator not responding | Try `xcrun simctl shutdown all` then boot fresh. |
| Build succeeds but app crashes | Check `xcrun simctl launch --console` for runtime errors. |
| Tests hang indefinitely | Add `-destination-timeout` flag. Ensure simulator is booted first. |
| Wrong simulator selected | Always use UDID from `simctl list devices --json`, not device name alone. |
| Stale build artifacts | Use `clean build` action or delete derived data directory. |

Related Skills

using-git-worktrees

16
from diegosouzapw/awesome-omni-skill

Use when starting feature work that needs isolation from current workspace or before executing implementation plans - creates isolated git worktrees with smart directory selection and safety verifi...

axiom-xcode-mcp-setup

16
from diegosouzapw/awesome-omni-skill

Xcode MCP setup — enable mcpbridge, per-client config, permission handling, multi-Xcode targeting, troubleshooting

using-neon

16
from diegosouzapw/awesome-omni-skill

Guides and best practices for working with Neon Serverless Postgres. Covers getting started, local development with Neon, choosing a connection method, Neon features, authentication (@neondatabase/...

using-skillpack-maintenance

16
from diegosouzapw/awesome-omni-skill

Use when maintaining, enhancing, or modifying existing Claude Code plugins - handles skills, commands, agents, hooks, and reference sheets through systematic domain analysis, structure review, behavioral testing, and quality improvements

using-openai-platform

16
from diegosouzapw/awesome-omni-skill

OpenAI SDK development with GPT-5 family, Chat Completions, Responses API, embeddings, and tool calling. Use for AI-powered applications, chatbots, agents, and semantic search.

bgo

10
from diegosouzapw/awesome-omni-skill

Automates the complete Blender build-go workflow, from building and packaging your extension/add-on to removing old versions, installing, enabling, and launching Blender for quick testing and iteration.

Coding & Development

moai-lang-r

16
from diegosouzapw/awesome-omni-skill

R 4.4+ best practices with testthat 3.2, lintr 3.2, and data analysis patterns.

moai-lang-python

16
from diegosouzapw/awesome-omni-skill

Python 3.13+ development specialist covering FastAPI, Django, async patterns, data science, testing with pytest, and modern Python features. Use when developing Python APIs, web applications, data pipelines, or writing tests.

moai-icons-vector

16
from diegosouzapw/awesome-omni-skill

Vector icon libraries ecosystem guide covering 10+ major libraries with 200K+ icons, including React Icons (35K+), Lucide (1000+), Tabler Icons (5900+), Iconify (200K+), Heroicons, Phosphor, and Radix Icons with implementation patterns, decision trees, and best practices.

moai-foundation-trust

16
from diegosouzapw/awesome-omni-skill

Complete TRUST 4 principles guide covering Test First, Readable, Unified, Secured. Validation methods, enterprise quality gates, metrics, and November 2025 standards. Enterprise v4.0 with 50+ software quality standards references.

moai-foundation-memory

16
from diegosouzapw/awesome-omni-skill

Persistent memory across sessions using MCP Memory Server for user preferences, project context, and learned patterns

moai-foundation-core

16
from diegosouzapw/awesome-omni-skill

MoAI-ADK's foundational principles - TRUST 5, SPEC-First TDD, delegation patterns, token optimization, progressive disclosure, modular architecture, agent catalog, command reference, and execution rules for building AI-powered development workflows