gitbutlerapp/gitbutler · error

Failed to move new installation into place: {e}

Error message

Failed to move new installation into place: {e}

What it means

First macOS install (no previous app, hence no backup): fs::rename moving the staged .app into the install location failed. Staged artifacts are cleaned up and the raw rename error is reported. Nothing pre-existing was damaged, but the install did not land.

Source

Thrown at crates/but-installer/src/install_macos.rs:222

        cleanup_artifacts();

        // Critical failure - restore backup if we created one
        if had_backup && install_app_backup.exists() {
            warn("Failed to move new installation into place - restoring backup");
            if let Err(restore_err) = fs::rename(&install_app_backup, &install_app) {
                bail!(
                    "Failed to install new version: {}. Also failed to restore backup: {}. Your app may be at {}",
                    e,
                    restore_err,
                    install_app_backup.display()
                );
            }
            bail!(
                "Failed to install new version: {e}. Previous installation restored successfully."
            );
        }
        // No backup to restore, just fail
        bail!("Failed to move new installation into place: {e}");
    }

    // Update the symlink to point to the new installation
    let final_target = install_app.join("Contents/MacOS/gitbutler-tauri");
    let _ = fs::remove_file(&but_symlink);

    // Try to create symlink and verify - if either fails, rollback
    let symlink_result = unix_fs::symlink(&final_target, &but_symlink);
    let _ = fs::remove_file(&but_new);

    if let Err(e) = symlink_result {
        // Symlink creation failed - rollback to backup
        warn(&format!(
            "Failed to create symlink: {e} - attempting to restore backup"
        ));
        if install_app_backup.exists() {
            if let Err(remove_err) = fs::remove_dir_all(&install_app) {
                bail!(

View on GitHub (pinned to caf1f223d3)

Solutions

  1. Fix write permission on the install dir (or install as a user who owns it) and retry
  2. Free disk space - the swap needs roughly twice the bundle size
  3. Remove any partial leftover at the target path, then re-run but-installer
Defensive patterns

Strategy: validation

Validate before calling

// Ensure the install dir is writable before a first install
let probe = install_dir.join(".write-probe");
std::fs::create_dir_all(&install_dir)?;
std::fs::write(&probe, b"")?;
std::fs::remove_file(&probe)?; // Err here = permission/disk problem, fix before install

Try / catch

if let Err(e) = but_installer::run_installation_with_version(request, false) {
    if e.to_string().contains("Failed to move new installation into place") {
        // surface the fs error: EACCES -> permissions, ENOSPC -> space, EBUSY -> app running
        eprintln!("fix install-dir permissions/space and retry: {e}");
    }
    return Err(e);
}

Prevention

When it happens

Trigger: The install location is not writable by the current user (system /Applications without admin), the volume is full, or an unexpected object already occupies the target path in a form rename cannot atomically replace.

Common situations: Non-admin first install into /Applications on managed Macs; disk full; leftover partial bundle from a previous aborted install.

Related errors


AI-assisted analysis of gitbutlerapp/gitbutler@caf1f223d3 (2026-08-20). Data as JSON: /api/errors/a27d1d78b27f1bef. Report an issue: GitHub.