## xcrun_show_sdk_path

# Function xcrun_show_sdk_path

Source

    fn xcrun_show_sdk_path(
        sdk_name: &'static str,
        verbose: bool,
    ) -> Result<(PathBuf, String), XcrunError>

Expand description

Invoke `xcrun --sdk $sdk_name --show-sdk-path` to get the SDK path.

The exact logic that `xcrun` uses is unspecified (see `man xcrun` for a few details), and may change between macOS and Xcode versions, but it roughly boils down to finding the active developer directory, and then invoking `xcodebuild -sdk $sdk_name -version` to get the SDK details.

Finding the developer directory is roughly done by looking at, in order:

- The `DEVELOPER_DIR` environment variable.
- The `/var/db/xcode_select_link` symlink (set by `xcode-select --switch`).
- `/Applications/Xcode.app` (hardcoded fallback path).
- `/Library/Developer/CommandLineTools` (hardcoded fallback path).

Note that `xcrun` caches its result, but with a cold cache this whole operation can be quite slow, especially so the first time it’s run after a reboot.