{"record":{"id":"cfb56ac8ca47a8e4","repo":"tauri-apps/tauri","slug":"invalid-sdk-root","errorCode":null,"errorMessage":"Invalid SDK root {}","messagePattern":"Invalid SDK root (.+?)","errorType":"exception","errorClass":"tauri_cli::error::Error","httpStatus":null,"severity":"error","filePath":"crates/tauri-cli/src/mobile/ios/xcode_script.rs","lineNumber":168,"sourceCode":"      \"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\n  host_env.insert(\"RUST_BACKTRACE\", \"1\".as_ref());\n\n  host_env.insert(\"CFLAGS_x86_64_apple_darwin\", macos_isysroot.as_ref());\n  host_env.insert(\"CXXFLAGS_x86_64_apple_darwin\", macos_isysroot.as_ref());\n\n  host_env.insert(\n    \"OBJC_INCLUDE_PATH_x86_64_apple_darwin\",\n    include_dir.as_os_str(),\n  );\n\n  let framework_search_paths = options.framework_search_paths.join(\" \");\n  host_env.insert(\"FRAMEWORK_SEARCH_PATHS\", framework_search_paths.as_ref());","sourceCodeStart":150,"sourceCodeEnd":186,"githubUrl":"https://github.com/tauri-apps/tauri/blob/52e4b6e71d8632a7e648f866c442e287ecddee34/crates/tauri-cli/src/mobile/ios/xcode_script.rs#L150-L186","documentation":"The Xcode script helper also needs a macOS SDK to build host build-scripts: it derives it relatively from the iOS SDK root via `../../../../MacOSX.platform/Developer/SDKs/MacOSX.sdk` and uses it for CFLAGS_x86_64_apple_darwin/CXXFLAGS_x86_64_apple_darwin. If that relative path is not a directory, it bails with 'Invalid SDK root'.","triggerScenarios":"Building for iOS on a machine where the sibling MacOSX platform is missing — Command Line Tools-only installs, trimmed Xcode installs, or an iOS SDK root that does not live under the standard `<Xcode>/Platforms/iPhoneOS.platform/Developer/SDKs/` layout so the four-level `../` climb lands somewhere else.","commonSituations":"`xcode-select` pointing at CLT which has no MacOSX.platform next to the iOS SDK; copied/hand-rolled SDK trees; beta Xcode removed after the project was configured.","solutions":["Confirm the expected sibling exists: `test -d \"$(xcode-select -p)/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk\"`.","Switch to full Xcode: `sudo xcode-select -s /Applications/Xcode.app/Contents/Developer`.","Install/reinstall full Xcode from the App Store so the MacOSX platform ships alongside iPhoneOS.","Avoid custom SDK roots that break the assumed platform directory layout."],"exampleFix":"# before\nxcode-select -p\n# /Library/Developer/CommandLineTools  -> MacOSX.platform not found next to iOS SDK\n\n# after\nsudo xcode-select -s /Applications/Xcode.app/Contents/Developer\nls \"$(xcode-select -p)/Platforms/MacOSX.platform/Developer/SDKs/\"","handlingStrategy":"validation","validationCode":"DEVDIR=$(xcode-select -p)\ntest -d \"$DEVDIR/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk\" \\\n  && echo ok || echo \"install full Xcode and xcode-select it\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Install full Xcode (not only Command Line Tools) on machines that build Tauri iOS apps.","Keep exactly one active Xcode via xcode-select; clean up deleted Xcode copies.","Validate the MacOSX platform exists in CI image build scripts."],"tags":["tauri-cli","ios","macos","sdk","build-scripts","xcode"],"backgroundTag":"invalid-sdk-path","analyzedSha":"52e4b6e71d8632a7e648f866c442e287ecddee34","analyzedAt":"2026-08-20T13:59:20.734Z","schemaVersion":2},"datasetVersion":"2026-08-31T22:30:34.772Z"}