openai/codex · error · anyhow::Error

hdiutil detach failed with

Error message

hdiutil detach failed with {status}

What it means

detach_dmg cleanup step: `hdiutil detach` on the mounted installer volume returned non-zero, usually because the volume is busy (a file or app on it is open). The install itself may already have succeeded.

Solutions

  1. Close anything opened from the mounted DMG and retry
  2. Detach manually with `hdiutil detach` (add -force if needed)
  3. Ignore if the copy succeeded; macOS unmounts on reboot
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at codex-rs/cli/src/desktop_app/mac.rs:291 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of openai/codex@339751715c (2026-08-25). Data as JSON: /api/errors/30fac561a81b7429. Report an issue: GitHub.

Appendix: source

Thrown at codex-rs/cli/src/desktop_app/mac.rs:291

    let stdout = String::from_utf8_lossy(&output.stdout);
    parse_hdiutil_attach_mount_point(&stdout)
        .map(PathBuf::from)
        .with_context(|| format!("failed to parse mount point from hdiutil output:\n{stdout}"))
}

async fn detach_dmg(mount_point: &Path) -> anyhow::Result<()> {
    let status = Command::new("hdiutil")
        .arg("detach")
        .arg(mount_point)
        .status()
        .await
        .context("failed to invoke `hdiutil detach`")?;

    if status.success() {
        return Ok(());
    }
    anyhow::bail!("hdiutil detach failed with {status}");
}

fn find_codex_app_in_mount(mount_point: &Path) -> anyhow::Result<PathBuf> {
    let direct = mount_point.join("Codex.app");
    if direct.is_dir() {
        return Ok(direct);
    }

    for entry in std::fs::read_dir(mount_point).with_context(|| {
        format!(
            "failed to read {mount_point}",
            mount_point = mount_point.display()
        )
    })? {
        let entry = entry.context("failed to read mount directory entry")?;
        let path = entry.path();
        if path.extension().is_some_and(|ext| ext == "app") && path.is_dir() {
            return Ok(path);

View on GitHub (pinned to 339751715c)