{"record":{"id":"47596aad359fc5ae","repo":"tauri-apps/tauri","slug":"include-dir-was-invalid-doesn-t-exist-or-isn-t","errorCode":null,"errorMessage":"Include dir was invalid. {} doesn't exist or isn't a directory","messagePattern":"Include dir 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":156,"sourceCode":"        .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() {\n      crate::error::bail!(\"Invalid SDK root {}\", macos_sdk_root.display());\n    }\n    format!(\"-isysroot {}\", macos_sdk_root.display())\n  };\n\n  let mut host_env = HashMap::<&str, &OsStr>::new();\n","sourceCodeStart":138,"sourceCodeEnd":174,"githubUrl":"https://github.com/tauri-apps/tauri/blob/52e4b6e71d8632a7e648f866c442e287ecddee34/crates/tauri-cli/src/mobile/ios/xcode_script.rs#L138-L174","documentation":"After validating the iOS SDK root in the Xcode script helper, tauri-cli checks that `<sdk_root>/usr/include` exists, because that include directory is exported as OBJC_INCLUDE_PATH_<triple> for the Rust build. If it is missing, the SDK is considered incomplete/corrupt and the build stops.","triggerScenarios":"Building the iOS app in Xcode where the SDK root directory exists but its `usr/include` folder does not — typically a partially downloaded/corrupted iOS platform, or an SDK root argument that points at the platform folder instead of the inner `.sdk` folder (e.g. .../iPhoneOS.platform instead of .../iPhoneOS.sdk).","commonSituations":"Interrupted `xcodebuild -downloadPlatform iOS` leaving a truncated SDK; pointing `--sdk-root` at the wrong folder level; macOS upgraded and the SDK structure moved; unusual Xcode installs (beta vs stable mixing).","solutions":["Verify manually: `test -d \"$(xcrun --sdk iphoneos --show-sdk-path)/usr/include\" && echo ok`.","Reinstall the iOS platform: `xcodebuild -downloadPlatform iOS` (delete the partial platform first if needed).","If overriding SDK root, point it at the exact `.sdk` directory reported by `xcrun --sdk iphoneos --show-sdk-path`.","As a last resort reinstall Xcode."],"exampleFix":"# before\n# --sdk-root /Applications/Xcode.app/.../Platforms/iPhoneOS.platform\n# error: Include dir was invalid. .../usr/include doesn't exist\n\n# after\n# --sdk-root /Applications/Xcode.app/.../Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS17.0.sdk\n# or simply let Xcode pass SDKROOT untouched","handlingStrategy":"validation","validationCode":"SDK=$(xcrun --sdk iphoneos --show-sdk-path)\ntest -d \"$SDK/usr/include\" && echo \"include ok\" || xcodebuild -downloadPlatform iOS","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never abort `xcodebuild -downloadPlatform iOS` mid-download; verify afterwards.","Point --sdk-root at the inner .sdk directory, not the .platform directory.","Re-check after every Xcode major upgrade."],"tags":["tauri-cli","ios","sdk","include-path","xcode"],"backgroundTag":"invalid-sdk-path","analyzedSha":"52e4b6e71d8632a7e648f866c442e287ecddee34","analyzedAt":"2026-08-20T13:59:20.734Z","schemaVersion":2},"datasetVersion":"2026-08-31T22:30:34.772Z"}