xcrun
TLDR
Find the path to a developer tool
SYNOPSIS
xcrun [--sdk sdkname] [--toolchain name] [--find tool] [--run tool] [--show-sdk-path] [--log] [--verbose] [--kill-cache] [tool arguments ...]
DESCRIPTION
xcrun is macOS's command-line utility for locating and invoking developer tools from the Xcode toolchain. It serves as an intelligent wrapper that finds the correct version of tools like clang, swift, ld, and others based on the active Xcode installation and selected SDK.
The tool resolves the complexity of having multiple Xcode versions or SDKs installed by automatically selecting the appropriate tool version. It respects the DEVELOPER_DIR environment variable and the setting from xcode-select, making it essential for build scripts and CI/CD pipelines that need consistent tool resolution.
Beyond simple tool invocation, xcrun provides access to powerful subcommands through tools like simctl for iOS Simulator management, notarytool for app notarization, altool for App Store uploads, and stapler for attaching notarization tickets.
PARAMETERS
--sdk sdkname
Use the specified SDK (e.g., macosx, iphoneos, iphonesimulator).--toolchain name
Use the specified toolchain.--find tool
Print the full path to the specified tool.--run tool
Run the specified tool (default behavior when tool name given).--show-sdk-path
Print the path to the selected SDK.--show-sdk-version
Print the version of the selected SDK.--show-sdk-platform-path
Print the platform path for the selected SDK.--show-sdk-platform-version
Print the platform version for the selected SDK.--log
Print the executed command to stderr.--verbose
Show verbose output.--no-cache
Do not use cached values for tool paths.--kill-cache
Clear the tool path cache.-h, --help
Display help information.
CAVEATS
Only available on macOS with Xcode or Command Line Tools installed. Tool resolution fails if no valid developer directory is configured (use xcode-select --install to fix). Cached paths may become stale after Xcode updates; use --kill-cache to refresh. Some tools require a full Xcode installation rather than just Command Line Tools.
HISTORY
xcrun was introduced by Apple alongside the separation of developer tools into the Xcode application bundle. It became the standard way to invoke command-line developer tools starting with Xcode 4 around 2011, replacing direct paths to tools that were previously in /usr/bin. This architecture allows multiple Xcode versions to coexist and enables tools to be versioned with their parent Xcode release.
SEE ALSO
xcode-select(1), xcodebuild(1), clang(1), swift(1), simctl(1)


