Storage Management
Use the interactive cleaner to review and remove XcodeBuildMCP-managed workspace storage when isolated build artifacts, logs, result bundles, or temporary state start taking too much disk space.
XcodeBuildMCP gives each workspace its own managed storage so parallel agents can safely build and test the same project from different worktrees, branches, or cloned checkouts. This avoids different sessions overwriting each other's DerivedData, result bundles, logs, and temporary runtime state.
The tradeoff is disk usage. Safer parallel isolation can create multiple copies of build artifacts for the same app, so xcodebuildmcp purge exists to help you review and clean that storage deliberately.
The normal cleanup path is interactive:
xcodebuildmcp purgeThis opens a guided cleaner that shows projects, workspaces, and direct child folders. It keeps the prompt compact, avoids dumping long file lists, and asks for confirmation before deleting anything.
xcodebuildmcp purge does not silently clean DerivedData in the background. Interactive cleanup asks before deleting. Destructive non-interactive cleanup requires --delete, explicit --classes, and the confirmation phrase shown by --help.
XcodeBuildMCP already runs conservative lifecycle cleanup for managed logs and managed result bundles. That automatic sweep is narrow: it protects recent files and active helper processes, and it does not delete DerivedData. Use xcodebuildmcp purge when you want visibility, explicit cleanup, or DerivedData cleanup.
When to use it
Use the cleaner when:
- your disk is filling up after many builds or test runs;
- you work across many branches, worktrees, or cloned copies of the same app;
- an agent has created lots of per-workspace build state;
- you want to inspect XcodeBuildMCP-managed storage before removing anything.
If you only need regular build, test, launch, or UI automation commands, you do not need this guide.
Interactive cleanup flow
Run the command with no mode in a TTY:
xcodebuildmcp purgeThe flow starts with the biggest projects and lets you drill down:
- Pick a project group.
- Pick one workspace, multiple workspaces, or the whole group.
- Pick folders in one workspace, or delete all folders for selected workspaces.
- Review the compact deletion summary.
- Confirm or cancel.
DerivedData is shown as a folder choice, but it remains explicit. The cleaner calls it out before confirmation because deleting DerivedData can reclaim a lot of space but also makes later Xcode builds slower until caches are rebuilt.
What XcodeBuildMCP stores
| Storage class | What it contains | Cleanup behavior |
|---|---|---|
derivedData | Xcode build products, indexes, module caches, and intermediates for a workspace | Opt-in only. Select it explicitly. |
logs | XcodeBuildMCP-managed build, daemon, and simulator helper logs | Safe default cleanup target. Recent or active logs are protected. |
resultBundles | Managed .xcresult bundles and completion marker files | Safe default cleanup target. Active or incomplete bundles are protected. |
stateTransients | Stale daemon, OSLog, and Xcode IDE bridge temporary state | Cleaned only when it is safe to identify as stale. |
The locks directory can appear in reports, but purge does not delete it as a storage class.
Scriptable report mode
Use report mode when you want details for a script, CI diagnostic, or issue report.
xcodebuildmcp purge --reportFor machine-readable output:
xcodebuildmcp purge --report --jsonA bare report covers all known workspaces so you can see where space is going. Reports include total usage, workspace usage, family usage, and storage-class usage for the selected scope.
Scriptable dry-run mode
Dry-run mode builds the deletion plan without removing files.
xcodebuildmcp purge --dry-run --scope current --classes logs,resultBundles,stateTransientsWithout an explicit scope, dry-run and delete target the current workspace. This keeps cleanup narrow by default.
To include DerivedData, name it directly:
xcodebuildmcp purge --dry-run --scope current --classes derivedData --older-than 7d--older-than accepts day values such as 1d, 7d, 14d, or 30d. The age check uses the newest file or directory inside a candidate, so a directory with fresh contents is not selected just because the directory itself looks old.
Scriptable delete mode
Use non-interactive delete mode only when you already know the scope and classes you want to remove.
xcodebuildmcp purge --delete \
--scope current \
--classes logs,resultBundles,stateTransients \
--confirm delete-xcodebuildmcp-storageFor DerivedData cleanup, keep the selection explicit:
xcodebuildmcp purge --delete \
--scope current \
--classes derivedData \
--older-than 14d \
--confirm delete-xcodebuildmcp-storageDuring deletion, XcodeBuildMCP revalidates every candidate under the workspace filesystem lock. If a path changed since planning, moved outside the expected workspace folder, contains a symbolic link, belongs to an active helper process, or no longer matches the managed artifact pattern, it is skipped instead of deleted.
Scope options
| Scope | Meaning |
|---|---|
--scope current | Current workspace. Best default for manual cleanup. |
--scope workspace --workspace-key <key> | One explicit workspace key. |
--scope family --family <name> | All recognized workspaces with the same project basename prefix. |
--scope all | Every recognized workspace on the machine. Use with care. |
Unknown workspace keys appear in reports, but broad all and family purge scopes skip them. Use explicit workspace scope if you need to clean one.
Managing DerivedData intentionally
By default, builds use isolated DerivedData under XcodeBuildMCP-managed workspace storage. This avoids cross-project and cross-worktree build conflicts, especially when multiple agents build at the same time.
If you intentionally want to manage DerivedData elsewhere, set sessionDefaults.derivedDataPath in your project config. That moves Xcode's build products to the path you provide, so you are then responsible for its cleanup policy.
schemaVersion: 1
sessionDefaults:
derivedDataPath: ./.derivedDataSee Session Defaults for the full config model.