zed-industries/zed · error

failed to copy app: {:?}

Error message

failed to copy app: {:?}

What it means

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.

Source

Thrown at crates/auto_update/src/auto_update.rs:1205

    let unmounter = MacOsUnmounter {
        mount_path: mount_path.clone(),
        background_executor,
    };

    let mut cmd = new_command("rsync");
    cmd.args(["-av", "--delete", "--exclude", "Icon?"])
        .arg(&mounted_app_path)
        .arg(&running_app_path);
    let rsync_output = cmd.output().await;

    // Await the unmount (even if rsync failed) so that the installer temp dir
    // can be deleted once this function returns.
    unmounter.unmount().await;

    let output = rsync_output.with_context(|| "failed to rsync: {cmd}")?;

    anyhow::ensure!(
        output.status.success(),
        "failed to copy app: {:?}",
        String::from_utf8_lossy(&output.stderr)
    );

    Ok(None)
}

/// Removes stale installer dirs from the system temp dir. Older Zed versions
/// leaked one per update by deleting the dir while the downloaded disk image
/// was still mounted inside it, which made the deletion fail silently.
#[cfg(any(rust_analyzer, all(not(target_os = "windows"), not(test))))]
async fn cleanup_stale_installer_dirs() {
    const STALE_INSTALLER_DIR_AGE: Duration = Duration::from_secs(24 * 60 * 60);

    let temp_dir = std::env::temp_dir();
    let Ok(mut entries) = fs::read_dir(&temp_dir).await else {
        log::warn!("failed to read temp dir {temp_dir:?} while cleaning up installer dirs");

View on GitHub (pinned to bc538def45)

Solutions

  1. Fix ownership: `sudo chown -R $(whoami) /Applications/Zed.app` (or your custom app path) and retry.
  2. Ensure free disk space on the Applications volume.
  3. Exclude Zed.app from antivirus/endpoint-protection real-time scanning.
  4. If the bundle is partially synced, reinstall from a fresh zed.dev download.

Example fix

# before: update fails, app bundle owned by root
ls -ld /Applications/Zed.app   # drwxr-xr-x@ root wheel

# after: give the current user write access, then retry the update
sudo chown -R $(whoami) /Applications/Zed.app
Defensive patterns

Strategy: validation

Validate before calling

fn app_bundle_is_writable(app: &Path) -> bool {
    let probe = app.join(".update-probe");
    let writable = std::fs::File::create(&probe).is_ok();
    let _ = std::fs::remove_file(&probe);
    writable
}
// check before starting the install step
anyhow::ensure!(app_bundle_is_writable(&running_app_path), "app bundle is not writable");

Try / catch

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.

Prevention

When it happens

Trigger: 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.

Common situations: App originally installed via drag-and-drop as admin (root-owned /Applications/Zed.app); endpoint protection locking the bundle; full disk.

Related errors


AI-assisted analysis of zed-industries/zed@bc538def45 (2026-08-16). Data as JSON: /api/errors/c40f2bb7af2ce26f. Report an issue: GitHub.