{"record":{"id":"91e7092699f626e3","repo":"tauri-apps/tauri","slug":"rustc-could-not-be-found-did-you-install-rust","errorCode":null,"errorMessage":"\"rustc\" could not be found, did you install Rust?","messagePattern":"\"rustc\" could not be found, did you install Rust\\?","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tauri-cli/src/interface/rust.rs","lineNumber":1141,"sourceCode":"              .context(\"Couldn't inherit value for `authors` from workspace\")\n          })\n          .unwrap()\n      }),\n      default_run: cargo_package_settings.default_run.clone(),\n    };\n\n    let cargo_config = CargoConfig::load(tauri_dir)?;\n\n    let target_triple = target.unwrap_or_else(|| {\n      cargo_config\n        .build()\n        .target()\n        .map(|t| t.to_string())\n        .unwrap_or_else(|| {\n          let output = Command::new(\"rustc\")\n            .args([\"-vV\"])\n            .output()\n            .expect(\"\\\"rustc\\\" could not be found, did you install Rust?\");\n          let stdout = String::from_utf8_lossy(&output.stdout);\n          stdout\n            .split('\\n')\n            .find(|l| l.starts_with(\"host:\"))\n            .unwrap()\n            .replace(\"host:\", \"\")\n            .trim()\n            .to_string()\n        })\n    });\n    let target_platform = TargetPlatform::from_triple(&target_triple);\n\n    Ok(Self {\n      manifest: Mutex::new(manifest),\n      cargo_settings,\n      cargo_package_settings,\n      cargo_ws_package_settings: ws_package_settings,\n      package_settings,","sourceCodeStart":1123,"sourceCodeEnd":1159,"githubUrl":"https://github.com/tauri-apps/tauri/blob/52e4b6e71d8632a7e648f866c442e287ecddee34/crates/tauri-cli/src/interface/rust.rs#L1123-L1159","documentation":"To pick a default Rust target triple, the CLI runs `rustc -vV` and parses the `host:` line when no explicit target is configured (tauri.conf.json build.target or .cargo/config.toml build.target). This expect fires when spawning the rustc process fails, almost always ErrorKind::NotFound: rustc is not installed or ~/.cargo/bin is not on PATH in this environment.","triggerScenarios":"Any `tauri build`/`tauri dev`/`tauri bundle` command on a machine where `rustc` is not resolvable via PATH: fresh CI runner without a Rust toolchain, IDE launched from the GUI (macOS apps do not inherit shell PATH), rustup installed under a different user, or a bare container without Rust.","commonSituations":"CI pipelines missing the Rust setup step; VS Code / JetBrains tasks running with a sanitized PATH; switching shells or using mise/asdf without shims activated; devcontainers without the rust toolchain layer.","solutions":["Install Rust via rustup (`curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh`) and open a new terminal so ~/.cargo/bin is on PATH.","Verify with `rustc -vV` in the same shell/terminal the tauri command runs in.","For IDE-launched tasks on macOS, launch the IDE from the terminal (`code .`) or add ~/.cargo/bin to ~/.zprofile so GUI apps see it.","Alternatively set an explicit target (`build.target` in tauri.conf.json or `build.target` in .cargo/config.toml) so the CLI never needs to invoke rustc for host detection.","In CI, add a rustup step (e.g. dtolnay/rust-toolchain@stable) before the tauri step."],"exampleFix":"# .github/workflows/build.yml\n# before: no rust toolchain -> panics on rustc spawn\n- run: npm run tauri build\n\n# after\n- uses: dtolnay/rust-toolchain@stable\n- run: npm run tauri build","handlingStrategy":"validation","validationCode":"# Fail fast before any tauri command\ncommand -v rustc >/dev/null 2>&1 && rustc -vV | grep -q '^host:' || {\n  echo 'rustc not found on PATH — install via rustup'; exit 1;\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Add a rustup/toolchain setup step in CI before tauri jobs (dtolnay/rust-toolchain@stable).","Launch IDEs from a shell (or add ~/.cargo/bin to login shell profiles) so GUI apps inherit the Rust PATH.","Set build.target in tauri.conf.json or .cargo/config.toml on machines where host detection is unreliable."],"tags":["rust","tauri-cli","rustc","path","environment","toolchain"],"backgroundTag":"rustc-not-found","analyzedSha":"52e4b6e71d8632a7e648f866c442e287ecddee34","analyzedAt":"2026-08-20T13:59:20.734Z","schemaVersion":2},"datasetVersion":"2026-08-31T22:30:34.772Z"}