hdiutil: create failed - Resource busy macOS Origin: Platform & cloud Last updated 5 Nov 2026

macOS: hdiutil: create failed - Resource busy (or: hdiutil: couldn't eject "disk2" - Resource busy)

A disk image operation failed because the volume or a file in it is still in use (Finder, Spotlight, a terminal).

Exact message you may see hdiutil: create failed - Resource busyhdiutil: couldn't eject disk2 - Resource busyhdiutil: detach failed - Resource busyhdiutil: couldn't unmount disk - Resource busycreate-dmg Resource busy
Seen on: macOS

Meaning

Close windows/terminals using the volume, wait for Spotlight, then detach with hdiutil detach -force /Volumes/NAME. In build scripts retry detach a few times and disable Spotlight indexing (mdutil -i off /Volumes/NAME). lsof +D /Volumes/NAME shows who uses it.

Common causes

  • Finder window open on the volume
  • Spotlight (mds) indexing the new volume
  • A shell cd'd into /Volumes/NAME
  • Backup/AV software scanning
  • Duplicate image mounted under the same name

⚡ Quick fix

  1. lsof +D /Volumes/NAME then close the process
  2. hdiutil detach -force /Volumes/NAME
  3. Retry with a short sleep in scripts

Detailed fix by platform

macOS

  1. hdiutil info | grep -E "image-path|/dev/disk" && hdiutil detach -force /Volumes/NAME

How to diagnose

  1. Users — lsof output?
  2. Spotlight — Indexing?
  3. Retry — Delay added?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: Platform & cloud. Errors that are often confused with or caused by this one (click to open):

Finder error code -36 — macOS: The Finder can't complete the operation because some data in "x" can't be read or written. (Error code -36) (macOS)Finder error code -36hdiutil: image not recognized / no mountable file systems — macOS: hdiutil: attach failed - image not recognized / no mountable file systems (macOS)hdiutil: image not re…Homebrew Cask: It seems there is already an App at — Homebrew: Error: It seems there is already an App at '/Applications/Chrome.app' (macOS)Homebrew Cask: It see…Homebrew: No available formula with the name — Homebrew: Error: No available formula with the name "x". Did you mean ...? (macOS)Homebrew: No availabl…Volume failed to unmount / disk not ejected because in use — macOS: diskutil: Unmount of disk2s1 failed: at least one volume could not be unmounted / The disk wasn't ejected because one or more programs may be using it (macOS)Volume failed to unmo…Your Command Line Tools are too outdated — Homebrew: Error: Your Command Line Tools (CLT) are too outdated. Update them from Software Update / Please update to the latest macOS (macOS)Your Command Line Too…zsh: bad CPU type in executable — macOS (Apple Silicon): zsh: bad CPU type in executable: ./tool (macOS)zsh: bad CPU type in …hdiutil: …

Explore the map of this error Full error map →

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.

💬 What worked for others

No tips yet — did something else fix this for you?

Share what worked for you

Tips are checked by an editor before they appear. Links are removed.