{"record":{"id":"894c0efb848393c9","repo":"tauri-apps/tauri","slug":"sdk-root-provided-by-xcode-was-invalid-doesn-t","errorCode":null,"errorMessage":"SDK root provided by Xcode was invalid. {} doesn't exist or isn't a directory","messagePattern":"SDK root provided by Xcode was invalid\\. (.+?) doesn't exist or isn't a directory","errorType":"exception","errorClass":"tauri_cli::error::Error","httpStatus":null,"severity":"error","filePath":"crates/tauri-cli/src/mobile/ios/xcode_script.rs","lineNumber":149,"sourceCode":"  )?;\n\n  if !cli_options.config.is_empty() {\n    crate::helpers::config::merge_config_with(\n      &mut tauri_config,\n      &cli_options\n        .config\n        .iter()\n        .map(|conf| &conf.0)\n        .collect::<Vec<_>>(),\n    )?;\n  }\n\n  let env = env()\n    .context(\"failed to load iOS environment\")?\n    .explicit_env_vars(cli_options.vars);\n\n  if !options.sdk_root.is_dir() {\n    crate::error::bail!(\n      \"SDK root provided by Xcode was invalid. {} doesn't exist or isn't a directory\",\n      options.sdk_root.display(),\n    );\n  }\n  let include_dir = options.sdk_root.join(\"usr/include\");\n  if !include_dir.is_dir() {\n    crate::error::bail!(\n      \"Include dir was invalid. {} doesn't exist or isn't a directory\",\n      include_dir.display()\n    );\n  }\n\n  // Host flags that are used by build scripts\n  let macos_isysroot = {\n    let macos_sdk_root = options\n      .sdk_root\n      .join(\"../../../../MacOSX.platform/Developer/SDKs/MacOSX.sdk\");\n    if !macos_sdk_root.is_dir() {","sourceCodeStart":131,"sourceCodeEnd":167,"githubUrl":"https://github.com/tauri-apps/tauri/blob/52e4b6e71d8632a7e648f866c442e287ecddee34/crates/tauri-cli/src/mobile/ios/xcode_script.rs#L131-L167","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"# before\nxcode-select -p\n# /Applications/Xcode_15.0.app/...  (deleted Xcode)\n# SDK root provided by Xcode was invalid.\n\n# after\nsudo xcode-select -s /Applications/Xcode.app/Contents/Developer\nxcodebuild -downloadPlatform iOS\nxcrun --sdk iphoneos --show-sdk-path  # verify it exists","handlingStrategy":"validation","validationCode":"# Verify the SDK root Xcode will pass exists before building\nSDK=$(xcrun --sdk iphoneos --show-sdk-path 2>/dev/null)\n[ -n \"$SDK\" ] && [ -d \"$SDK\" ] && echo \"sdk ok: $SDK\" || echo \"sdk broken - fix xcode-select\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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."],"tags":["tauri-cli","ios","xcode","sdk","build-script"],"backgroundTag":"invalid-sdk-path","analyzedSha":"52e4b6e71d8632a7e648f866c442e287ecddee34","analyzedAt":"2026-08-20T13:59:20.734Z","schemaVersion":2},"datasetVersion":"2026-08-31T22:30:34.772Z"}