xcodebuild-clean
Remove build artifacts and intermediate files for Xcode projects. Validates project existence and Xcode installation before executing, then returns structured JSON with execution status and duration.
Instructions
xcodebuild-clean
⚡ Clean build artifacts with validation and structured output
What it does
Removes build artifacts and intermediate files for an Xcode project or workspace. Pre-validates that the project exists and Xcode is properly installed before executing, providing clear error messages if something is misconfigured. Returns structured JSON responses with execution status, duration, and any errors encountered during the clean operation.
Why you'd use it
Resolve build issues by removing stale or corrupted build artifacts
Free up disk space occupied by intermediate build files
Ensure clean builds from scratch without cached compilation results
Get structured feedback with execution time and success status
Parameters
Required
projectPath (string): Path to .xcodeproj or .xcworkspace file
scheme (string): Build scheme name to clean
Optional
configuration (string): Build configuration to clean (e.g., "Debug", "Release")
Returns
Structured JSON response containing success status, command executed, execution duration, output messages, and exit code. Includes both stdout and stderr for comprehensive debugging. Operation typically completes in under 3 minutes.
Examples
Clean default configuration
const result = await xcodebuildCleanTool({
projectPath: "/path/to/MyApp.xcodeproj",
scheme: "MyApp"
});Clean specific configuration
const cleanRelease = await xcodebuildCleanTool({
projectPath: "/path/to/MyApp.xcworkspace",
scheme: "MyApp",
configuration: "Release"
});Related Tools
xcodebuild-build: Build after cleaning
xcodebuild-list: Discover available schemes
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| projectPath | Yes | ||
| scheme | Yes | ||
| configuration | No |