{"record":{"id":"c40f2bb7af2ce26f","repo":"zed-industries/zed","slug":"failed-to-copy-app","errorCode":null,"errorMessage":"failed to copy app: {:?}","messagePattern":"failed to copy app: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/auto_update/src/auto_update.rs","lineNumber":1205,"sourceCode":"\n    let unmounter = MacOsUnmounter {\n        mount_path: mount_path.clone(),\n        background_executor,\n    };\n\n    let mut cmd = new_command(\"rsync\");\n    cmd.args([\"-av\", \"--delete\", \"--exclude\", \"Icon?\"])\n        .arg(&mounted_app_path)\n        .arg(&running_app_path);\n    let rsync_output = cmd.output().await;\n\n    // Await the unmount (even if rsync failed) so that the installer temp dir\n    // can be deleted once this function returns.\n    unmounter.unmount().await;\n\n    let output = rsync_output.with_context(|| \"failed to rsync: {cmd}\")?;\n\n    anyhow::ensure!(\n        output.status.success(),\n        \"failed to copy app: {:?}\",\n        String::from_utf8_lossy(&output.stderr)\n    );\n\n    Ok(None)\n}\n\n/// Removes stale installer dirs from the system temp dir. Older Zed versions\n/// leaked one per update by deleting the dir while the downloaded disk image\n/// was still mounted inside it, which made the deletion fail silently.\n#[cfg(any(rust_analyzer, all(not(target_os = \"windows\"), not(test))))]\nasync fn cleanup_stale_installer_dirs() {\n    const STALE_INSTALLER_DIR_AGE: Duration = Duration::from_secs(24 * 60 * 60);\n\n    let temp_dir = std::env::temp_dir();\n    let Ok(mut entries) = fs::read_dir(&temp_dir).await else {\n        log::warn!(\"failed to read temp dir {temp_dir:?} while cleaning up installer dirs\");","sourceCodeStart":1187,"sourceCodeEnd":1223,"githubUrl":"https://github.com/zed-industries/zed/blob/bc538def4545534201bbfcac4e95ac34ea6501b6/crates/auto_update/src/auto_update.rs#L1187-L1223","documentation":"macOS install step: after mounting the new image, the app bundle is synced over the running app with `rsync -av --delete --exclude Icon?`; the unmount is always awaited first, then a failed rsync reports its stderr. Failure means the running app path was not writable or files were locked.","triggerScenarios":"rsync cannot write into the current app location (e.g. /Applications/Zed.app owned by root or another user), the bundle is locked by security software, or the volume is full.","commonSituations":"App originally installed via drag-and-drop as admin (root-owned /Applications/Zed.app); endpoint protection locking the bundle; full disk.","solutions":["Fix ownership: `sudo chown -R $(whoami) /Applications/Zed.app` (or your custom app path) and retry.","Ensure free disk space on the Applications volume.","Exclude Zed.app from antivirus/endpoint-protection real-time scanning.","If the bundle is partially synced, reinstall from a fresh zed.dev download."],"exampleFix":"# before: update fails, app bundle owned by root\nls -ld /Applications/Zed.app   # drwxr-xr-x@ root wheel\n\n# after: give the current user write access, then retry the update\nsudo chown -R $(whoami) /Applications/Zed.app","handlingStrategy":"validation","validationCode":"fn app_bundle_is_writable(app: &Path) -> bool {\n    let probe = app.join(\".update-probe\");\n    let writable = std::fs::File::create(&probe).is_ok();\n    let _ = std::fs::remove_file(&probe);\n    writable\n}\n// check before starting the install step\nanyhow::ensure!(app_bundle_is_writable(&running_app_path), \"app bundle is not writable\");","typeGuard":null,"tryCatchPattern":"on \"failed to copy app\", detect permission errors in stderr, fix ownership (chown) and retry; otherwise advise a manual reinstall because the bundle may be partially synced.","preventionTips":["Install the app as the user who runs it","Avoid admin-owned drag-and-drop installs","Keep free space on the Applications volume"],"tags":["macos","rsync","permissions","app-bundle","auto-update"],"backgroundTag":null,"analyzedSha":"bc538def4545534201bbfcac4e95ac34ea6501b6","analyzedAt":"2026-08-16T07:30:46.435Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}