Skip to content
Back to skills

Xcodebuild

ASecurity

Build, test, and archive iOS/macOS apps with xcodebuild and Xcode CLI tools. Use for CI integration, scheme management, simulator control, and build troubleshooting.

  • 8 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added September 6, 2026
toolsgoswiftbashgitdocumentation

Works with

  • cli

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned September 6, 2026

npx -y skills add v1truv1us/ai-eng-system --skill xcodebuild --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Xcodebuild?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Xcodebuild
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/v1truv1us-xcodebuild/badge)](https://www.skillsdirectory.com/skills/v1truv1us-xcodebuild)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: xcodebuild
description: Build, test, and archive iOS/macOS apps with xcodebuild and Xcode CLI tools. Use for CI integration, scheme management, simulator control, and build troubleshooting.
metadata:
  category: user-invoked
disable-model-invocation: true
---

Default output: return only the result, blockers, and required evidence. Omit preambles, process narration, repeated context, confidence scores, and follow-up offers. Use at most five bullets unless a required artifact or schema needs more.

# Xcode Build Engineering

## Current Versions (Verify Before Use)

```bash
xcodebuild -version                 # Xcode version
xcrun simctl list devices           # Available simulators
xcrun --show-sdk-path               # SDK path
swift --version                     # Swift version
```

Check [Xcode release notes](https://developer.apple.com/documentation/xcode-release-notes) for the latest version.

## Core Principles

1. **Command-line first.** If you can't build from `xcodebuild`, your CI will break.
2. **Schemes are shared.** Every scheme used in CI must be marked "Shared" in Xcode.
3. **DerivedData is disposable.** Clean builds should succeed. Cache selectively.
4. **Simulators are ephemeral.** Don't depend on simulator state between runs.

## Build Commands

```bash
# Basic build
xcodebuild -workspace MyApp.xcworkspace -scheme MyApp -destination 'platform=iOS Simulator,name=iPhone 15' build

# Run tests
xcodebuild -workspace MyApp.xcworkspace -scheme MyApp -destination 'platform=iOS Simulator,name=iPhone 15' test

# Archive for distribution
xcodebuild -workspace MyApp.xcworkspace -scheme MyApp -configuration Release archive -archivePath build/MyApp.xcarchive

# Export IPA
xcodebuild -exportArchive -archivePath build/MyApp.xcarchive -exportPath build -exportOptionsPlist ExportOptions.plist
```

## CI Integration

```yaml
# .github/workflows/ios.yml
- uses: maxim-lobanov/setup-xcode@v1
  with:
    xcode-version: latest-stable
- run: xcodebuild -workspace MyApp.xcworkspace -scheme MyApp -destination 'platform=iOS Simulator,name=iPhone 15' test
```

## Common Anti-Patterns

| Anti-Pattern | Why It's Wrong | Fix |
|---|---|---|
| Non-shared scheme in CI | CI can't find the scheme | Check "Shared" in Manage Schemes |
| Hardcoded simulator name | Breaks when new Xcode drops old simulators | Use `xcrun simctl list` dynamically |
| Signing in CI without match | Manual provisioning is fragile | Use fastlane match or Xcode Cloud |
| Committing DerivedData | Bloated repo, conflicts | Add to `.gitignore` |
| No `-derivedDataPath` | Pollutes default location, cache issues | Explicit path in CI |

## Validation Checklist

- [ ] Build succeeds with clean DerivedData
- [ ] Tests pass on CI simulator
- [ ] All schemes used in CI are shared
- [ ] `-derivedDataPath` set explicitly in CI
- [ ] Code signing works in CI (manual or automatic)
- [ ] Archive + export tested before release

## Official Resources

- [xcodebuild man page](https://keith.github.io/xcode-man-pages/xcodebuild.html)
- [Xcode CLI docs](https://developer.apple.com/library/archive/technotes/tn2339/_index.html)
- [fastlane](https://docs.fastlane.tools/) for signing and distribution automation

Files in this skill

  • SKILL.md3.1 KB
  • evals/evals.json1.1 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…