XCRUN(1) | BSD General Commands Manual | XCRUN(1) |
xcrun - Run or locate development tools and properties.
xcrun [--sdk <SDK name>] --find <tool name>
xcrun [--sdk <SDK name>] <tool name> ... tool arguments ...
<tool name> ... tool arguments ...
xcrun provides a means to locate or invoke developer tools from the command-line, without requiring users to modify Makefiles or otherwise take inconvenient measures to support multiple Xcode tool chains.
The tool xcode-select(1) is used to set a system default for the active developer directory, and may be overridden by the DEVELOPER_DIR environment variable (see ENVIRONMENT).
The SDK which will be searched defaults to the most recent available SDK, and can be specified by the SDKROOT environment variable or the --sdk option (which takes precedences over SDKROOT). When used to invoke another tool (as opposed to simply finding it), xcrun will provide the absolute path to the selected SDK in the SDKROOT environment variable. See ENVIRONMENT for more information.
xcrun supports several different usages, to both look up the paths to tools as well as execute them.
When used with the --find argument, as in xcrun [--sdk <SDK name>] --find <tool name>, the absolute path to the tool (in the provided SDK, if given) will be printed.
When used without --find, the name of a tool is required and the tool will be executed with the provided arguments.
When used as the target of a symbolic link, it derives the tool name to use from the name it was invoked under, and then executes that tool.
Use xcodebuild -showsdks to list the available SDK names.
CPATH
DEVELOPER_DIR
LIBRARY_PATH
SDKROOT
This environment variable is also set by xcrun to be the absolute path to the user provided SDK (either via SDKROOT or the --sdk option), when it is used to invoke a normal developer tool (build tools like xcodebuild or make are exempt from this behavior).
For example, if xcrun is used to invoke clang via:
then xcrun will provide the full path to the macosx SDK in the environment variable SDKROOT. That in turn will be used by clang(1) to automatically select that SDK when compiling the test.c file.
TOOLCHAINS
xcrun_log
xcrun_nocache
xcrun_verbose
xcrun --find clang
xcrun --sdk iphoneos --find texturetool
xcrun --sdk macosx --show-sdk-path
xcrun git status
When xcrun is invoked with the name xcrun, the options --log and --verbose are useful debugging aids. The option --no-cache can be used to bypass cache lookup, but often at a significant cost in performance.
When xcrun has taken the place of another tool, the arguments are those of the tool replaced, and the various xcrun options can't be used. In this case, use the specific environment variables instead.
xcodebuild(1), xcode-select(1)
July 9, 2015 | Mac OS X |