tauri-apps/tauri · error · tauri_cli::error::Error
SDK root provided by Xcode was invalid. {} doesn't exist or
Error message
SDK root provided by Xcode was invalid. {} doesn't exist or isn't a directory What it means
The `tauri ios xcode-script` helper (invoked by the Xcode build phase of a generated Tauri project) validates that the SDK root Xcode handed it (via the `--sdk-root` option, normally derived from `SDKROOT`) exists and is a directory before compiling the Rust portion. If the path does not exist or is a file, it bails immediately.
Source
Thrown at crates/tauri-cli/src/mobile/ios/xcode_script.rs:149
)?;
if !cli_options.config.is_empty() {
crate::helpers::config::merge_config_with(
&mut tauri_config,
&cli_options
.config
.iter()
.map(|conf| &conf.0)
.collect::<Vec<_>>(),
)?;
}
let env = env()
.context("failed to load iOS environment")?
.explicit_env_vars(cli_options.vars);
if !options.sdk_root.is_dir() {
crate::error::bail!(
"SDK root provided by Xcode was invalid. {} doesn't exist or isn't a directory",
options.sdk_root.display(),
);
}
let include_dir = options.sdk_root.join("usr/include");
if !include_dir.is_dir() {
crate::error::bail!(
"Include dir was invalid. {} doesn't exist or isn't a directory",
include_dir.display()
);
}
// Host flags that are used by build scripts
let macos_isysroot = {
let macos_sdk_root = options
.sdk_root
.join("../../../../MacOSX.platform/Developer/SDKs/MacOSX.sdk");
if !macos_sdk_root.is_dir() {View on GitHub (pinned to 52e4b6e71d)
Solutions
- Check what the real SDK path is: `xcrun --sdk iphoneos --show-sdk-path` and confirm that directory exists.
- Fix `xcode-select -s /Applications/Xcode.app/Contents/Developer` and retry the Xcode build.
- If the script phase passes `--sdk-root`, correct or remove the override so Xcode's SDKROOT is used.
- Reinstall the iOS platform (`xcodebuild -downloadPlatform iOS`) if the SDK directory is genuinely missing.
Example fix
# before xcode-select -p # /Applications/Xcode_15.0.app/... (deleted Xcode) # SDK root provided by Xcode was invalid. # after sudo xcode-select -s /Applications/Xcode.app/Contents/Developer xcodebuild -downloadPlatform iOS xcrun --sdk iphoneos --show-sdk-path # verify it exists
Defensive patterns
Strategy: validation
Validate before calling
# Verify the SDK root Xcode will pass exists before building SDK=$(xcrun --sdk iphoneos --show-sdk-path 2>/dev/null) [ -n "$SDK" ] && [ -d "$SDK" ] && echo "sdk ok: $SDK" || echo "sdk broken - fix xcode-select"
Prevention
- After switching Xcode versions always re-run `xcode-select -s <full Xcode path>`.
- Don't hardcode `--sdk-root` in the Xcode script phase; let SDKROOT flow from Xcode.
- Add an SDK existence check to CI before invoking xcodebuild.
When it happens
Trigger: Building the generated iOS app in Xcode where the resolved SDK root path is stale or wrong: Xcode moved/renamed after the project was generated, a custom `--sdk-root` argument points at a nonexistent path, `xcode-select` points to a broken installation, or multiple Xcode versions leave a dangling SDKROOT.
Common situations: Switching between Xcode versions (e.g. via xcodes/xcodes.app), deleting an old Xcode.app while the build settings still reference its SDK, CI images where SDKROOT is set manually, or editing the Run Script phase and mistyping the argument.
Related errors
- Include dir was invalid. {} doesn't exist or isn't a directo
- Invalid SDK root {}
- iOS platform not installed
- Arch specified by Xcode was invalid. {arch} isn't a known ar
- Library not found at {}. Make sure your Cargo.toml file has
AI-assisted analysis of tauri-apps/tauri@52e4b6e71d (2026-08-20).
Data as JSON: /api/errors/894c0efb848393c9.
Report an issue: GitHub.