tauri-apps/tauri · error · tauri_cli::error::Error
Invalid SDK root {}
Error message
Invalid SDK root {} What it means
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'.
Source
Thrown at crates/tauri-cli/src/mobile/ios/xcode_script.rs:168
"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() {
crate::error::bail!("Invalid SDK root {}", macos_sdk_root.display());
}
format!("-isysroot {}", macos_sdk_root.display())
};
let mut host_env = HashMap::<&str, &OsStr>::new();
host_env.insert("RUST_BACKTRACE", "1".as_ref());
host_env.insert("CFLAGS_x86_64_apple_darwin", macos_isysroot.as_ref());
host_env.insert("CXXFLAGS_x86_64_apple_darwin", macos_isysroot.as_ref());
host_env.insert(
"OBJC_INCLUDE_PATH_x86_64_apple_darwin",
include_dir.as_os_str(),
);
let framework_search_paths = options.framework_search_paths.join(" ");
host_env.insert("FRAMEWORK_SEARCH_PATHS", framework_search_paths.as_ref());View on GitHub (pinned to 52e4b6e71d)
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.
Example fix
# before xcode-select -p # /Library/Developer/CommandLineTools -> MacOSX.platform not found next to iOS SDK # after sudo xcode-select -s /Applications/Xcode.app/Contents/Developer ls "$(xcode-select -p)/Platforms/MacOSX.platform/Developer/SDKs/"
Defensive patterns
Strategy: validation
Validate before calling
DEVDIR=$(xcode-select -p) test -d "$DEVDIR/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk" \ && echo ok || echo "install full Xcode and xcode-select it"
Prevention
- 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.
When it happens
Trigger: 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.
Common situations: `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.
Related errors
- SDK root provided by Xcode was invalid. {} doesn't exist or
- Include dir was invalid. {} doesn't exist or isn't a directo
- 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/cfb56ac8ca47a8e4.
Report an issue: GitHub.