Skip to content
Latchkey

Tauri "error running bundle_dmg.sh" on macOS in CI

Tauri builds the macOS DMG by running bundle_dmg.sh, which uses hdiutil to attach and detach a disk image. On a headless CI runner hdiutil can fail with "Resource busy" or AppleScript errors, failing the bundle.

What this error means

tauri build on macOS fails with "Error failed to bundle project: error running bundle_dmg.sh" and an hdiutil "Resource busy" or "could not access" message.

tauri
Error failed to bundle project: error running bundle_dmg.sh:
hdiutil: couldn't eject "disk4" - Resource busy
error: failed to bundle the application

Common causes

hdiutil resource contention on the runner

A previous attach was not detached, so hdiutil reports the device busy when bundle_dmg.sh tries to eject or attach.

AppleScript window styling fails headless

bundle_dmg.sh uses AppleScript/Finder to style the DMG window; with no GUI session this can error.

How to fix it

Retry the DMG bundle step

hdiutil "Resource busy" is frequently transient; detach stale images and re-run the bundle.

Terminal
hdiutil detach /Volumes/* 2>/dev/null || true
npx tauri build --bundles dmg

Build only the .app to skip DMG styling

If you do not need a DMG in CI, bundle the app target and create the DMG separately.

Terminal
npx tauri build --bundles app

How to prevent it

  • Detach leftover disk images before bundling.
  • Limit concurrency so two DMG builds do not race on hdiutil.
  • Skip the DMG bundle in jobs that only need the .app.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →