Skip to content

Instantly share code, notes, and snippets.

@durul
Forked from ddunbar/xcbuild-debugging-tricks.md
Last active August 4, 2017 17:08
Show Gist options
  • Save durul/ae95a8ed762ba4b40f64063b79bb8513 to your computer and use it in GitHub Desktop.
Save durul/ae95a8ed762ba4b40f64063b79bb8513 to your computer and use it in GitHub Desktop.
Xcode new build system debugging tricks

New Build System Tricks

Command Line

# enable internal menu
defaults write com.apple.dt.Xcode ShowDVTDebugMenu -bool YES

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

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

iOS Simulator using simctl 📱🎮

# Use simctl list and iOS Simulator devices
xcrun simctl list devices

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment