{"record":{"id":"4802e2ee3359f330","repo":"gitbutlerapp/gitbutler","slug":"installation-failed-and-no-backup-available-to-res-4802e2","errorCode":null,"errorMessage":"Installation failed and no backup available to restore","messagePattern":"Installation failed and no backup available to restore","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/but-installer/src/install_macos.rs","lineNumber":278,"sourceCode":"        warn(\"Final installation verification failed - attempting to restore backup\");\n        if install_app_backup.exists() {\n            fs::remove_dir_all(&install_app)?;\n            fs::rename(&install_app_backup, &install_app)?;\n\n            let restored_target = install_app.join(\"Contents/MacOS/gitbutler-tauri\");\n            let _ = fs::remove_file(&but_symlink);\n            unix_fs::symlink(&restored_target, &but_symlink)?;\n\n            if validate_installed_binary(&but_symlink) {\n                success(\"Backup was restored successfully\");\n                bail!(\"Installation failed but your previous installation was restored\");\n            } else {\n                bail!(\n                    \"Installation failed and backup restoration also failed - 'but' command may not work\"\n                );\n            }\n        } else {\n            bail!(\"Installation failed and no backup available to restore\");\n        }\n    }\n\n    success(&format!(\n        \"{} installed successfully\",\n        app_basename.to_string_lossy()\n    ));\n    // Remove backup on success\n    let _ = fs::remove_dir_all(&install_app_backup);\n\n    success(\"GitButler CLI (but) installed successfully\");\n\n    Ok(())\n}\n\nfn copy_dir_all(src: &Path, dst: &Path) -> io::Result<()> {\n    fs::create_dir_all(dst)?;\n    for entry in fs::read_dir(src)? {","sourceCodeStart":260,"sourceCodeEnd":296,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/caf1f223d3cfb94488c9198ad34487c6006c648f/crates/but-installer/src/install_macos.rs#L260-L296","documentation":"First macOS install: the final 'but --version' validation of the installed symlink failed and there is no previous app to restore. The new app is in place but its CLI does not run. Same execution-failure class as the rollback variants, with nothing to fall back to.","triggerScenarios":"Fresh install where the binary is blocked by Gatekeeper quarantine, corrupted, or the wrong architecture - and no prior version exists to restore.","commonSituations":"First install on a managed/locked-down Mac; Apple Silicon without Rosetta receiving an x86_64 build; truncated download.","solutions":["Run the binary directly to see the block reason: /Applications/GitButler.app/Contents/MacOS/gitbutler-tauri --version","Clear the quarantine attribute: xattr -dr com.apple.quarantine /Applications/GitButler.app, or allow the app in Privacy & Security","Install Rosetta if needed, then re-run the installer","Retry the install to replace a possibly corrupted first download"],"exampleFix":"# before: freshly installed binary blocked by quarantine\nxattr -dr com.apple.quarantine /Applications/GitButler.app\n# after\n~/.local/bin/but --version   # runs","handlingStrategy":"validation","validationCode":"// Before first install on macOS: can this host run the artifact at all?\nlet rosetta_ok = std::env::consts::ARCH == \"aarch64\"\n    && std::path::Path::new(\"/Library/Apple/usr/libexec/oah/libRosettaRuntime\").exists();\nanyhow::ensure!(\n    std::env::consts::ARCH == \"x86_64\" || rosetta_ok,\n    \"x86_64 artifact on arm64 requires Rosetta; install it first\"\n);","typeGuard":null,"tryCatchPattern":"if let Err(e) = but_installer::run_installation_with_version(request, false) {\n    let msg = e.to_string();\n    if msg.contains(\"no backup available to restore\") {\n        let _ = std::process::Command::new(\"xattr\")\n            .args([\"-dr\", \"com.apple.quarantine\"])\n            .arg(\"/Applications/GitButler.app\").status();\n        return but_installer::run_installation_with_version(request, false); // one retry\n    }\n    return Err(e);\n}","preventionTips":["Pre-clear quarantine policy/allowlists for GitButler before scripted first installs","Install Rosetta on Apple Silicon before deploying x86_64 artifacts","Retry a failed first install once after clearing quarantine"],"tags":["rust","macos","gatekeeper","first-install","binary-validation","but-installer"],"backgroundTag":"installation-rollback","analyzedSha":"caf1f223d3cfb94488c9198ad34487c6006c648f","analyzedAt":"2026-08-20T07:55:40.983Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}