{"record":{"id":"7480042b359b653a","repo":"gitbutlerapp/gitbutler","slug":"could-not-remove-quarantine-attribute-e-macos","errorCode":null,"errorMessage":"Could not remove quarantine attribute: {e} - macOS may show security warnings","messagePattern":"Could not remove quarantine attribute: (.+?) - macOS may show security warnings","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"crates/but-installer/src/install_macos.rs","lineNumber":104,"sourceCode":"            .map(|c| format!(\" channel {}\", c.display_name()))\n            .unwrap_or_default(),\n        install_app.display()\n    ));\n\n    // Clean up any leftover temp files from previous failed installations\n    let _ = fs::remove_dir_all(&install_app_new);\n    let _ = fs::remove_dir_all(&install_app_backup);\n\n    // Create Applications directory if it doesn't exist\n    fs::create_dir_all(home_dir.join(\"Applications\"))?;\n\n    // Install to temporary location first\n    info(\"Installing to temporary location...\");\n    copy_dir_all(app_dir, &install_app_new)?;\n\n    // Remove macOS quarantine attribute\n    if let Err(e) = remove_quarantine_recursive(&install_app_new) {\n        warn(&format!(\n            \"Could not remove quarantine attribute: {e} - macOS may show security warnings\"\n        ));\n        info(\"If macOS blocks the app, go to System Settings > Privacy & Security and allow it\");\n    }\n\n    // Create bin directory\n    let bin_dir = home_dir.join(\".local/bin\");\n    fs::create_dir_all(&bin_dir)?;\n\n    // Check for existing 'but' and detect channel switching\n    let but_symlink = bin_dir.join(\"but\");\n    let but_new = bin_dir.join(\"but.new\");\n\n    if but_symlink.exists() && !but_symlink.is_symlink() {\n        // 'but' exists but is not a symlink\n        let now = std::time::SystemTime::now()\n            .duration_since(std::time::UNIX_EPOCH)\n            .unwrap_or_default()","sourceCodeStart":86,"sourceCodeEnd":122,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/58e5313667b857ef39a730e380af31816a7b1768/crates/but-installer/src/install_macos.rs#L86-L122","documentation":"On macOS the installer copies the staged .app to a temp location and runs remove_quarantine_recursive to strip the com.apple.quarantine xattr. If that fails, it warns with the error and notes macOS may show Gatekeeper security warnings, then continues the install and tells the user how to allow the app manually.","triggerScenarios":"Raised in install_app (download_and_install_app) when remove_quarantine_recursive(&install_app_new) returns Err — typically xattr not available, the process lacks permission to change extended attributes, or the filesystem doesn't support xattrs (e.g. certain network/SMB volumes).","commonSituations":"Installing from a non-terminal context without permissions to run xattr; binaries not ad-hoc signed; installs onto SMB/NFS shares; hardened runtime environments; xattr command missing in minimal environments.","solutions":["Continue with the install; when macOS blocks the app, open System Settings > Privacy & Security and click 'Allow Anyway' as the log suggests.","Clear quarantine manually: xattr -dr com.apple.quarantine /Applications/<App>.app.","Install onto the local APFS volume instead of a network mount.","Run the installer from a normal terminal session with permission to modify extended attributes."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"# Check quarantine status before/after install\nimport subprocess\ndef has_quarantine(path):\n    r = subprocess.run(['xattr', path], capture_output=True)\n    return b'com.apple.quarantine' in r.stdout","typeGuard":null,"tryCatchPattern":"// Warn-and-continue pattern\nif let Err(e) = remove_quarantine_recursive(&install_app_new) {\n    warn(\"quarantine not removed: {e}; allow the app in System Settings > Privacy & Security\");\n}","preventionTips":["Run the installer from a local APFS volume, not a network mount","Be ready to click 'Allow Anyway' in System Settings > Privacy & Security after first launch","Prefer signed/notarized release artifacts so quarantine matters less"],"tags":["macos","installer","quarantine","gatekeeper"],"backgroundTag":"operation-not-supported","analyzedSha":"58e5313667b857ef39a730e380af31816a7b1768","analyzedAt":"2026-09-18T06:50:32.052Z","contentChangedAt":"2026-09-18T06:50:32.052Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}