tauri-apps/tauri · error

"rustc" could not be found, did you install Rust?

Error message

"rustc" could not be found, did you install Rust?

What it means

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.

Source

Thrown at crates/tauri-cli/src/interface/rust.rs:1141

              .context("Couldn't inherit value for `authors` from workspace")
          })
          .unwrap()
      }),
      default_run: cargo_package_settings.default_run.clone(),
    };

    let cargo_config = CargoConfig::load(tauri_dir)?;

    let target_triple = target.unwrap_or_else(|| {
      cargo_config
        .build()
        .target()
        .map(|t| t.to_string())
        .unwrap_or_else(|| {
          let output = Command::new("rustc")
            .args(["-vV"])
            .output()
            .expect("\"rustc\" could not be found, did you install Rust?");
          let stdout = String::from_utf8_lossy(&output.stdout);
          stdout
            .split('\n')
            .find(|l| l.starts_with("host:"))
            .unwrap()
            .replace("host:", "")
            .trim()
            .to_string()
        })
    });
    let target_platform = TargetPlatform::from_triple(&target_triple);

    Ok(Self {
      manifest: Mutex::new(manifest),
      cargo_settings,
      cargo_package_settings,
      cargo_ws_package_settings: ws_package_settings,
      package_settings,

View on GitHub (pinned to 52e4b6e71d)

Solutions

  1. 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.
  2. Verify with `rustc -vV` in the same shell/terminal the tauri command runs in.
  3. For IDE-launched tasks on macOS, launch the IDE from the terminal (`code .`) or add ~/.cargo/bin to ~/.zprofile so GUI apps see it.
  4. 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.
  5. In CI, add a rustup step (e.g. dtolnay/rust-toolchain@stable) before the tauri step.

Example fix

# .github/workflows/build.yml
# before: no rust toolchain -> panics on rustc spawn
- run: npm run tauri build

# after
- uses: dtolnay/rust-toolchain@stable
- run: npm run tauri build
Defensive patterns

Strategy: validation

Validate before calling

# Fail fast before any tauri command
command -v rustc >/dev/null 2>&1 && rustc -vV | grep -q '^host:' || {
  echo 'rustc not found on PATH — install via rustup'; exit 1;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of tauri-apps/tauri@52e4b6e71d (2026-08-20). Data as JSON: /api/errors/91e7092699f626e3. Report an issue: GitHub.