How to Eject a Disk That Says It's in Use on a Mac

When you eject an external drive and macOS answers that the disk wasn't ejected because one or more programs may be using it, something still has a file open on that disk. macOS refuses to unmount it so that nothing is lost in the middle of a write. The fix is always the same: find what holds the disk, close it, eject again, and force the eject only as a last resort.
Here is how to find the culprit with the tools built into macOS, and how Folia Files can name it for you.
Why macOS says the disk is in use
A disk can't be unmounted while any process has a file, a folder or a working directory open on it. The usual suspects:
- An app with a document open from the disk: a video in a player, a project in an editor, a photo library.
- Spotlight, indexing a disk it has just discovered (processes named
mds_storesormdworker). A drive you have just plugged in is often busy for a few minutes. - Time Machine, backing up to that disk or checking it.
- Quick Look, making thumbnails of files you just browsed.
- A Terminal window whose current folder is on the disk. Nothing looks open, but the shell itself holds the disk.
- A copy still running, sometimes in another app.
The Finder sometimes names the app in its alert, but often you only get the generic message, with no hint of who is responsible.
First, close the obvious and try again
- Save and close every document that lives on the disk. If you're not sure which app uses it, quit the apps you opened files from.
- Close the Finder windows that show the disk. In Terminal, type
cd ~in any window that was working on it. - If the disk was connected a moment ago, or a Time Machine backup is running, wait a minute.
- Eject again: select the disk in the Finder sidebar and press ⌘E, or click the eject button next to its name.
That solves most cases. If the disk still refuses, find out exactly who is holding it.
Find what is using the disk with Terminal
lsof ("list open files") comes with macOS. Open Terminal and type the following, replacing MyDisk with the name of your disk as it appears in the Finder:
lsof /Volumes/MyDisk
Given a disk's mount point, lsof lists every file open on that disk. If the name contains spaces, put it in quotes: lsof "/Volumes/My Disk".
Reading the result
Each line is one open file. The columns that matter:
- COMMAND: the process, such as
QuickTime,zshormds_stores. - PID: its number, which is also shown in Activity Monitor.
- FD:
cwdmeans the process's current folder is on the disk (a Terminal window, typically). - NAME: the file itself.
If nothing appears but the disk still refuses, run the same command with sudo lsof /Volumes/MyDisk and type your password: system services such as Spotlight and Time Machine run as another user, and only an administrator sees their files.
Then quit the app normally (save your work first) and eject again. Avoid killing a process that is writing to the disk: that's the very data loss the refusal protects you from.
Activity Monitor, if you prefer not to type
In Activity Monitor, double-click a process and open the tab that lists its open files and ports: if paths under /Volumes/MyDisk appear, that process is the one. It works, but you have to guess which process to inspect, one at a time. lsof answers the question in one go.
When it's Spotlight or Time Machine
If lsof shows mds, mds_stores or mdworker, Spotlight is indexing the disk. Wait for it to finish, or, for a disk you never search, stop the indexing with sudo mdutil -i off /Volumes/MyDisk (or add the disk to Spotlight's privacy list in System Settings).
If it shows backupd, Time Machine is working on that disk. Let the backup finish, or stop it from Time Machine before ejecting: unplugging a backup disk mid-backup can damage the backup.
Force eject: when, and what it risks
When nothing works, the Finder may offer to force the eject, and Terminal can do it too:
diskutil unmount force /Volumes/MyDisk
A forced eject closes the files under the apps' feet: anything they haven't saved to the disk yet is lost, and a copy in progress is cut short. Use it for a disk you know nobody is writing to, for example a stuck disk image, never for a disk in the middle of a copy or a backup.
Let Folia Files tell you who holds the disk
Folia Files is a file manager for macOS, and it treats a refused eject as a question to answer rather than a dead end. When a disk won't eject, a banner says Couldn't eject "MyDisk" and lists what is using it, under names people recognize: the app itself, Spotlight (indexing the disk), Time Machine or Quick Look. Under that message:
- Quit "App" quits the app that holds the disk (up to two apps are offered), then ejects again by itself.
- Try Again simply retries, for example after Spotlight has finished.
- Force Eject… asks for confirmation first and says what it risks.

To eject everything at once, right-click a disk in the left sidebar and choose Eject 3 Disks (the number follows what is connected), or use the same command in the Folia Files menu in the menu bar. It ejects external disks and disk images, never network shares.
Eject before sleep (website edition)
Unplugging a laptop's drives when it's asleep is what usually triggers macOS's "Disk Not Ejected Properly" warning. In Settings › Files and Network › External Disks, Eject external disks before sleep and mount them again on wake unmounts them before the Mac sleeps (they stay attached) and mounts them back on wake. A disk in use at that moment stays mounted, and Folia Files tells you on wake.

Naming who holds a disk, Force Eject… and ejecting before sleep are in the website edition of Folia Files. The App Store edition's sandbox can't see other apps' open files: there, the banner shows macOS's message with Try Again, and lsof in Terminal remains the way to find the culprit.
Quick checklist
- Save and close the documents on the disk;
cd ~in Terminal. - Wait a minute if Spotlight or Time Machine may be working.
lsof /Volumes/MyDisk, thensudo lsof /Volumes/MyDisk, to see who holds it.- Quit that app and eject again with ⌘E.
- Force the eject only for a disk nobody is writing to.
If you'd rather have the answer without opening Terminal, download Folia Files: the next disk that refuses to eject will tell you why.


