tauri-apps/tauri · error

Failed to chmod script

Error message

Failed to chmod script

What it means

As part of DMG creation on macOS, the bundler writes a bundle script and then runs chmod 777 <script> to make it executable. The expect fires when the chmod child process cannot be spawned or exits unsuccessfully.

Source

Thrown at crates/tauri-bundler/src/bundle/macos/dmg/mod.rs:99

  write(&bundle_script_path, include_str!("./bundle_dmg"))?;
  write(
    support_directory_path.join("template.applescript"),
    include_str!("./template.applescript"),
  )?;
  write(
    support_directory_path.join("eula-resources-template.xml"),
    include_str!("./eula-resources-template.xml"),
  )?;

  // chmod script for execution
  Command::new("chmod")
    .arg("777")
    .arg(&bundle_script_path)
    .current_dir(&output_path)
    .stdout(Stdio::piped())
    .stderr(Stdio::piped())
    .output()
    .expect("Failed to chmod script");

  let dmg_settings = settings.dmg();

  let app_position = &dmg_settings.app_position;
  let application_folder_position = &dmg_settings.application_folder_position;
  let window_size = &dmg_settings.window_size;

  let app_position_x = app_position.x.to_string();
  let app_position_y = app_position.y.to_string();
  let application_folder_position_x = application_folder_position.x.to_string();
  let application_folder_position_y = application_folder_position.y.to_string();
  let window_size_width = window_size.width.to_string();
  let window_size_height = window_size.height.to_string();

  let mut bundle_dmg_cmd = Command::new(&bundle_script_path);

  bundle_dmg_cmd.args([
    "--volname",

View on GitHub (pinned to 52e4b6e71d)

Solutions

  1. Verify chmod resolves in the build environment: command -v chmod (normally /bin/chmod on macOS)
  2. Re-run tauri build --bundles dmg from a clean target directory so the script is freshly written before chmod runs
  3. Ensure target/release/bundle/dmg/ sits on a writable filesystem and is not locked by another process
  4. For hardened runners, disable sandboxing for the bundling step or ensure /usr/bin:/bin is on PATH
Defensive patterns

Strategy: validation

Validate before calling

# before DMG bundling, assert the tool exists in the build environment
command -v chmod >/dev/null || { echo 'chmod not on PATH — DMG bundling requires it'; exit 1; }

Prevention

When it happens

Trigger: tauri build --bundles dmg when chmod is unreachable (PATH scrubbed in CI or a sandbox without coreutils), when bundle_script_path or output_path was deleted between writing and chmodding, or when the filesystem denies the permission change (read-only or locked mount).

Common situations: CI images with a minimal PATH; hardened runners/sandboxes that block spawning shell utilities; antivirus or file watchers locking the script; output directory on a read-only volume.

Related errors


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