Skip to content

Isolate DerivedData per workspace to avoid conflicts with concurrent sessions #340

@codeman9

Description

@codeman9

When multiple MCP sessions (or CLI invocations) build the same project from different clones, they all share a single flat ~/Library/Developer/XcodeBuildMCP/DerivedData directory. Because xcodebuild only creates hashed per-project subdirectories when using its default DerivedData location — not when an explicit -derivedDataPath is passed — concurrent builds of the same project collide on the shared Build/, SourcePackages/, etc.

This causes corrupted incremental builds, race conditions, and unpredictable failures when running parallel agent sessions against separate clones of the same repo.

Proposed solution: Hash the workspace/project root path into the DerivedData subdirectory, e.g.:

~/Library/Developer/XcodeBuildMCP/DerivedData/<scheme>-<hash-of-workspace-root>/

This mirrors how Xcode isolates DerivedData per workspace in its default location. The hash should be derived from the resolved absolute path of the workspace or project file so that different clones get different directories automatically.

Current workaround: Set a unique XCODEBUILDMCP_DERIVED_DATA_PATH env var or derivedDataPath session default per session.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions