Skip to content

Instantly share code, notes, and snippets.

@ddunbar
Last active March 4, 2026 14:21
Show Gist options
  • Select an option

  • Save ddunbar/2dda0e836c855ea96759d1d05f086d69 to your computer and use it in GitHub Desktop.

Select an option

Save ddunbar/2dda0e836c855ea96759d1d05f086d69 to your computer and use it in GitHub Desktop.
Xcode new build system debugging tricks

New Build System Tricks

Command Line

alias xcbuild=$(xcode-select -p)/../SharedFrameworks/XCBuild.framework/Versions/A/Support/xcbuild
# THIS DOESNT WORK YET: xcbuild openIDEConsole  # … then switch to Xcode ➡️
xcbuild showSpecs
xcbuild build <foo.pif> [—target <target>]

# Some minimal additional logging (this is safe to leave on).
defaults write com.apple.dt.XCBuild EnableDebugActivityLogs -bool YES

# Enable build debugging mode (safe to leave on, but slows down the build system & litters DerivedData/<project>/Build/Intermediates.noindex), generally should only be enabled when trying to capture a trace for incremental build debugging purposes.
defaults write com.apple.dt.XCBuild EnableBuildDebugging -bool YES
# You can also use:
env EnableBuildDebugging=YES xcodebuild -UseNewBuildSystem=1 ...

# Use `xcbuild` to dump a headermap.
xcbuild headermap --dump <path>

IDE Console

open with Internal > XCBuild Console

writePIF <workspace name> <path>
        # … you can use this with the `xcbuild build …` command (above) to build via the service directly
showStatistics
clearAllCaches
setConfig EnableBuildDebugging true
	# … then save DerivedData & build log; same as above dwrite, but not persisted
@vvolkgang
Copy link

@ddunbar as of 2026, is there any up-to-date recipe for incremental builds in CI? I'm trying to speed up Github Workflow runs, caching the whole DerivedData folder helped cut it in half but looking at the .xcresult Timeline it's still compiling project level code, even when no changes were made. Between xcode26 Compilation Cache and old online tips like setting IgnoreFileSystemDeviceInodeChanges and restoring mtime, it's unclear what's the correct way to properly setup incremental builds. For reference, I'm using xcrun xcodebuild build-for-testing / xcrun xcodebuild test-without-building.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment