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).
hdiutil: create failed - Resource busyhdiutil: couldn't eject disk2 - Resource busyhdiutil: detach failed - Resource busyhdiutil: couldn't unmount disk - Resource busycreate-dmg Resource busy 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
lsof +D /Volumes/NAMEthen close the processhdiutil detach -force /Volumes/NAME- Retry with a short sleep in scripts
Detailed fix by platform
macOS
hdiutil info | grep -E "image-path|/dev/disk" && hdiutil detach -force /Volumes/NAME
How to diagnose
- Users — lsof output?
- Spotlight — Indexing?
- 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:
Similar errors
- 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)
- hdiutil: image not recognized / no mountable file systems macOS: hdiutil: attach failed - image not recognized / no mountable file systems
- Homebrew Cask: It seems there is already an App at Homebrew: Error: It seems there is already an App at '/Applications/Chrome.app'
Most viewed in macOS
- is damaged and can’t be opened macOS: “App” is damaged and can’t be opened. You should move it to the Trash.
- Operation not permitted (macOS privacy) macOS: Operation not permitted — Terminal/app lacks Full Disk Access (TCC privacy protection)
- zsh: command not found: brew macOS: zsh: command not found: brew (Homebrew not on PATH on Apple Silicon)
Other ways to find it
Where this error sits
Origin: Platform & cloud. Errors that are often confused with or caused by this one (click to open):
🧠 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.
Report a correction or suggest an improvement
Last updated 5 Nov 2026