Xcode build system guidance for xcodebuild operations. Use when building iOS projects, running tests, analyzing build failures, or configuring schemes. Covers build/clean/test operations, interpreting xcodebuild output, and troubleshooting common build errors.
Inherits all available tools
Additional assets for this skill
This skill inherits all available tools. When active, it can use any tool Claude has access to.
Use the execute_xcode_command MCP tool for all iOS build operations
The xclaude-plugin provides the execute_xcode_command MCP tool which consolidates all xcodebuild operations into a single, token-efficient dispatcher.
This is the most important rule: When working with iOS builds, you MUST use the execute_xcode_command MCP tool.
execute_xcode_command for all build/test/clean operationsxcodebuild commandsxcodebuild directly in bashxcrun xcodebuild in a terminalWhy? The MCP tool provides:
If execute_xcode_command fails, the issue is with parameters or the project - not that you should use bash.
| Task | ❌ WRONG (Bash) | ✅ RIGHT (MCP Tool) |
|---|---|---|
| List schemes | xcodebuild -list | execute_xcode_command op: "list" |
| Build app | xcodebuild -scheme... | execute_xcode_command op: "build" |
| Run tests | xcodebuild -scheme... test | execute_xcode_command op: "test" |
| Clean build | xcodebuild clean | execute_xcode_command op: "clean" |
| Get Xcode info | xcodebuild -version | execute_xcode_command op: "version" |
mkdir, cp, rm, ls, etc.grep, find, cat, etc.git status, git log, etc.which, xcode-select --version, etc.find . -name "*.swift", etc.| Task | MCP Tool | Operation | Key Parameters |
|---|---|---|---|
| Build for simulator | execute_xcode_command | build | scheme, configuration:Debug |
| Build for device | execute_xcode_command | build | scheme, configuration:Release, destination |
| Run tests | execute_xcode_command | test | scheme, destination |
| Clean build | execute_xcode_command | clean | scheme |
| List schemes | execute_xcode_command | list | - |
| Get Xcode info | execute_xcode_command | version | - |
Step 1: Discover Schemes - Use execute_xcode_command with operation: "list"
Invoke the execute_xcode_command MCP tool:
{
"operation": "list",
"project_path": "/path/to/Project.xcodeproj"
}
Note: project_path is optional - auto-detected from current directory.
Returns:
{
"schemes": ["MyApp", "MyAppTests", "MyAppUITests"],
"targets": ["MyApp", "MyAppKit", "MyAppTests"]
}
Step 2: Build - Use execute_xcode_command with operation: "build"
Invoke the execute_xcode_command MCP tool with build parameters:
{
"operation": "build",
"scheme": "MyApp",
"configuration": "Debug",
"destination": "platform=iOS Simulator,name=iPhone 15"
}
Common Destinations:
"platform=iOS Simulator,name=iPhone 15,OS=18.0""platform=iOS Simulator,name=iPhone 15" (will auto-detect latest OS)"platform=iOS,id=<device-udid>""platform=iOS Simulator,name=Any iOS Simulator Device""platform=macOS"Note: The destination parameter now supports auto-resolution! If you omit the OS version, the tool will automatically query available simulators and select the latest OS version for the specified device name. For explicit control, include the OS version in your destination string.
Unit Tests:
{
"operation": "test",
"scheme": "MyApp",
"destination": "platform=iOS Simulator,name=iPhone 15"
}
Specific Test Plan:
{
"operation": "test",
"scheme": "MyApp",
"destination": "platform=iOS Simulator,name=iPhone 15",
"options": {
"test_plan": "UnitTests"
}
}
Run Specific Tests:
{
"operation": "test",
"scheme": "MyApp",
"destination": "platform=iOS Simulator,name=iPhone 15",
"options": {
"only_testing": [
"MyAppTests/LoginTests/testSuccessfulLogin",
"MyAppTests/LoginTests/testInvalidCredentials"
]
}
}
Skip Specific Tests:
{
"operation": "test",
"scheme": "MyApp",
"destination": "platform=iOS Simulator,name=iPhone 15",
"options": {
"skip_testing": ["MyAppUITests"]
}
}
When to Clean:
{
"operation": "clean",
"scheme": "MyApp"
}
Clean + Build Pattern:
{
"operation": "build",
"scheme": "MyApp",
"configuration": "Debug",
"options": {
"clean_before_build": true
}
}
Debug (Default):
Release:
{
"operation": "build",
"scheme": "MyApp",
"configuration": "Release"
}
{
"operation": "build",
"scheme": "MyApp",
"options": {
"clean_before_build": true,
"parallel": true,
"sdk": "iphoneos17.0",
"arch": "arm64",
"quiet": false
}
}
Options Explained:
{
"success": true,
"summary": "Build succeeded",
"warnings": 3,
"build_time": "45.2s",
"scheme": "MyApp",
"configuration": "Debug"
}
{
"success": false,
"error": "Build failed",
"errors": 2,
"warnings": 5,
"failure_reason": "Compilation errors in ViewController.swift"
}
Large build logs use progressive disclosure:
{
"success": true,
"summary": "Build succeeded with 15 warnings",
"cache_id": "build-abc123",
"quick_stats": {
"warnings": 15,
"build_time": "62.3s"
},
"next_steps": [
"Use cache_id to get full build log if needed",
"Review warnings for potential issues"
]
}
Cause: Scheme doesn't exist or isn't shared
Solution:
list operation to see available schemesCause: Missing or invalid signing certificate
Solution:
{
"operation": "build",
"scheme": "MyApp",
"options": {
"code_sign_identity": "Apple Development",
"development_team": "TEAM_ID_HERE"
}
}
Cause: Requesting unavailable SDK version
Solution:
version operation to see available SDKssdk option or remove to use latestCause: Invalid destination specifier
Solution:
execute_simulator_command with operation "list" to see available devices1. list → Get test scheme
2. clean → Ensure fresh state
3. test → Run all tests
4. Analyze results → Check for failures
Run tests multiple times:
{
"operation": "test",
"scheme": "MyApp",
"options": {
"test_iterations": 5,
"retry_on_failure": true
}
}
Note: Test iteration support depends on Xcode version.
Tests return:
{
"success": false,
"tests_run": 45,
"tests_passed": 43,
"tests_failed": 2,
"failures": [
{
"test": "MyAppTests.LoginTests.testInvalidPassword",
"message": "XCTAssertEqual failed: (\"error\") is not equal to (\"invalid\")"
}
]
}
xcodebuild operations auto-detect project files:
.xcworkspace.xcodeprojExplicit Path:
{
"operation": "build",
"project_path": "/path/to/specific/Project.xcodeproj",
"scheme": "MyApp"
}
{
"options": {
"parallel": true
}
}
Don't clean unless necessary - incremental builds are much faster.
For CI/automated builds:
{
"options": {
"quiet": true
}
}
Default behavior - xcodebuild uses DerivedData for caching.
1. version → Verify Xcode installation
2. list → Validate scheme exists
3. clean → Ensure fresh build
4. build → Compile project
5. test → Run test suite
6. Analyze results → Fail pipeline if tests fail
Build produces:
.app bundle in DerivedData.xcresult test results bundleQuery build settings:
{
"operation": "list",
"project_path": "/path/to/Project.xcodeproj"
}
Returns scheme/target info. For detailed build settings, use Resource:
xc://reference/build-settings
Shared Schemes:
User Schemes:
Best Practice: Share schemes used for CI/CD.
This Skill works with execute_xcode_command tool:
execute_xcode_command toolxc://operations/xcode: Complete xcodebuild operations referencexc://reference/build-settings: Build settings dictionaryxc://reference/error-codes: Common error codes and solutionsTip: Use list to discover, build to compile, test to validate. Clean only when needed.