Disk Utility says it couldn't unmount the disk: find what is holding it and erase anyway
Erasing or partitioning fails because something is still using the drive. How to find the app holding it, unmount it properly, and when you need Recovery.
You click Erase or Partition in Disk Utility and it stops with Couldn't unmount disk. Something still has a file open on the drive. Once you close it, the erase goes through.
1. Find what is using it
# Replace with your drive's name
lsof +f -- /Volumes/YourDrive 2>/dev/null | awk 'NR==1 || !seen[$1]++'The first column is the program. Common ones:
| Program | What it is | What to do |
|---|---|---|
mds or mdworker | Spotlight indexing the drive | Wait, or turn indexing off for it |
backupd | Time Machine | Stop the backup |
Photos, Music | A library on the drive is open | Quit the app |
zsh, bash | A Terminal window is inside the drive | Close it or cd ~ |
# Stop Spotlight indexing this drive
sudo mdutil -i off /Volumes/YourDrive2. Unmount, then erase
diskutil list external # find the disk number
diskutil unmountDisk /dev/disk4
# only if that fails, and you are sure of the number:
diskutil unmountDisk force /dev/disk4Then go back to Disk Utility and erase. Forcing an unmount can lose data that was being written, which does not matter if you are about to erase it.
3. Erasing the Mac's own disk
The startup disk can never be unmounted while the Mac is running from it. To erase it, start up in macOS Recovery and use Disk Utility there. On Apple silicon, shut down and hold the power button until startup options appear.
Once erased, formatting for Mac and Windows and partitioning an external drive cover the next step.
Common questions
Why does Disk Utility say couldn't unmount disk?
A program still has a file open on the drive, often Spotlight indexing it, Time Machine, a Photos library, or a Terminal window. Close it and try again.
How do I force unmount a disk on a Mac?
Run diskutil unmountDisk force with the disk identifier from diskutil list. Check the number carefully first.
How do I erase my Mac's startup disk?
Start up in macOS Recovery and use Disk Utility there. The startup disk cannot be unmounted while the Mac is running from it.