denoland/deno · error

hdiutil failed to create DMG at {}

Error message

hdiutil failed to create DMG at {}

What it means

`hdiutil create -format UDZO <dmg>` exited non-zero while producing the distributable disk image; hdiutil's stderr is inherited and printed above this bail. hdiutil is finicky: common causes are insufficient disk space, an existing/locked file at the DMG path, and transient failures under system load.

Source

Thrown at cli/tools/desktop.rs:3529

      "create",
      "-volname",
      &app_name,
      "-srcfolder",
      &staging.path().display().to_string(),
      "-ov",
      "-format",
      "UDZO",
      &dmg_path.display().to_string(),
    ])
    .stdout(std::process::Stdio::null())
    .stderr(std::process::Stdio::inherit())
    .status()
    .context("Failed to run hdiutil")?;

  // staging tempdir is removed by its Drop impl when this fn returns.

  if !status.success() {
    bail!("hdiutil failed to create DMG at {}", dmg_path.display());
  }
  Ok(())
}

/// Zstd-compressed AppImage Type-2 runtime ELF stubs, vendored from
/// github.com/AppImage/type2-runtime at tag `20251108`. The selected runtime
/// is decompressed and prepended to the SquashFS payload when creating an
/// AppImage.
const APPIMAGE_RUNTIME_X86_64: &[u8] = include_bytes!(concat!(
  env!("OUT_DIR"),
  "/appimage_runtime/runtime-x86_64.zstd"
));
const APPIMAGE_RUNTIME_AARCH64: &[u8] = include_bytes!(concat!(
  env!("OUT_DIR"),
  "/appimage_runtime/runtime-aarch64.zstd"
));

/// 1×1 transparent PNG, used when the caller didn't supply an icon.

View on GitHub (pinned to f7822238ca)

Solutions

  1. Read the hdiutil stderr printed above the error for the specific reason.
  2. Delete any stale .dmg at the printed output path and re-run.
  3. Free disk space (hdiutil needs room for the compressed image plus staging).
  4. Re-run — transient hdiutil failures under load are common; avoid running parallel dmg builds to the same path.
Defensive patterns

Strategy: retry

Validate before calling

# Pre-flight: space and a clean output path
df -h "$TMPDIR" | awk 'NR==2 && $4+0 < 1024 { print "low disk space"; exit 1 }'
rm -f "$OUT_DIR/App.dmg"

Try / catch

for i in 1 2 3; do
  deno desktop ... && break
  echo "dmg build attempt $i failed (hdiutil) — retrying"
  rm -f "$OUT_DIR"/*.dmg
  [ "$i" = 3 ] && exit 1
  sleep $((i * 5))
done

Prevention

When it happens

Trigger: Building a macOS .dmg when: /tmp or the output volume is out of space; a stale .dmg from a previous run occupies the output path; another hdiutil/disk-images process holds resources; or a sandboxed environment blocks disk-image creation.

Common situations: CI runners with small temp disks; concurrent builds racing to the same output path; macOS VMs where the disk arbitration service is restricted.

Related errors


AI-assisted analysis of denoland/deno@f7822238ca (2026-08-20). Data as JSON: /api/errors/f7b6c248f8359d1d. Report an issue: GitHub.