Skip to content

[Bug]:  xcodemake incremental builds fails #466

Description

@reallyseth

Bug Description

 xcodemake incremental builds fail when derivedDataPath contains slashes; bundled xcodemake also inherits Git safe.bareRepository env

Summary

xcodebuildmcp simulator build fails when xcodemake incremental builds are enabled. The failure appears to come from the bundled xcodemake script constructing its capture log filename from the raw argument list, including -derivedDataPath /Users/..., which introduces / path separators into the log filename.

The current upstream johnno1962/xcodemake appears to have fixed this by writing logs under .xcodemake/ with sanitized/truncated argument text plus an MD5 hash.

Environment

  • xcodebuildmcp: 2.6.2 installed via Homebrew
  • macOS: Darwin
  • Xcode: 26.4 / build 17E192
  • Workflow: xcodebuildmcp simulator build
  • Simulator: iPhone 12

Command

time xcodebuildmcp simulator build \
  --scheme MyScheme \
  --workspace-path MyWorkspace.xcworkspace

Also reproduced after unsetting Git config env vars:

time env -u GIT_CONFIG_COUNT -u GIT_CONFIG_KEY_0 -u GIT_CONFIG_VALUE_0 \
  xcodebuildmcp simulator build \
  --scheme MyScheme \
  --workspace-path MyWorkspace.xcworkspace

Actual result

The build fails during xcodemake Makefile generation:

xcodemake is enabled and available, using it for incremental builds.
Generating Makefile with xcodemake (first build may take longer)

iOS Simulator Build build failed for scheme MyScheme.
Incremental build using xcodemake failed, suggest using preferXcodebuild option to try build again using slower xcodebuild command.

The reported build log path was not present afterward.

Running a patched copy of the bundled  xcodemake  that preserves logs exposed the underlying error:

Error: Cannot open log file xcodemake -workspace MyWorkspace.xcworkspace -scheme MyScheme -configuration Debug -skipMacroValidation -destination platform=iOS Simulator,id=... -collect-test-diagnostics never -derivedDataPath /Users/.../DerivedData/MyWorkspace-57a542dedf16 build.log for writing: No such file or directory

Expected result

xcodemake should generate its capture log using a safe filename/path and proceed to generate the Makefile so subsequent simulator builds can use the incremental make path.

Suspected cause

The bundled xcodemake in xcodebuildmcp 2.6.2 contains:

my $log = "xcodemake @original_ARGV.log";

When  @original_ARGV  includes an absolute  -derivedDataPath , the generated log filename contains  /Users/... , so opening the log fails with  No such file or directory .

Current upstream xcodemake uses a safer approach:

my $dir = ".xcodemake";
mkdir $dir unless -d $dir;
my $make = "$dir/Makefile";
...
my $log = "$dir/$logTag$logSuffix";

where  $logTag  is sanitized/truncated and  $logSuffix  includes an MD5 hash.

Additional related issue

The xcodemake/xcodebuild subprocess also inherits these Git environment variables in my shell:

GIT_CONFIG_COUNT=1
GIT_CONFIG_KEY_0=safe.bareRepository
GIT_CONFIG_VALUE_0=explicit

That causes SwiftPM package cache warnings/errors such as:

fatal: cannot use bare repository '/Users/.../Library/Caches/org.swift.swiftpm/repositories/...' (safe.bareRepository is 'explicit')

Unsetting these variables removes the SwiftPM cache issue, but xcodemake still fails due to the unsafe log filename.

Suggested fixes

1. Update the bundled xcodemake to the current upstream version, or at least adopt the upstream safe log filename generation.
2. Preserve the captured xcodemake/xcodebuild log on failure instead of deleting it, or include the underlying failure text in the XcodeBuildMCP error output.
3. Consider sanitizing inherited  GIT_CONFIG_COUNT ,  GIT_CONFIG_KEY_* , and  GIT_CONFIG_VALUE_*  for xcodebuild/SwiftPM subprocesses, or document that these env vars can break SwiftPM’s bare repository cache.

### Debug Output

I tried running `xcodebuildmcp doctor` and it seemed like that command is not a valid command. Am I missing something? 

### Editor/Client

I'm just running the CLI in macOS terminal.

### MCP Server Version

I'm running the latest

### LLM

Copilot - GPT 5.5

### MCP Configuration

```json

Steps to Reproduce

I'm trying to use incremental builds in xcodebuildmcp.

Expected Behavior

Build time should be quicker in successive builds.

Actual Behavior

Build times are long.

Error Messages

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Fields

    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