Why your external drive won't eject on Mac, and how to find what's using it
Your Mac won’t eject a drive while any app or background process still has a file or folder on it open. Find that process, quit it, and the eject works.
Finder says “The disk wasn’t ejected because one or more programs may be using it.” Sometimes it names the app, often it doesn’t. Here’s how to find the culprit and when forcing it is a bad idea.
The usual suspects
- A document is still open: a Pages file, a photo in Preview, a song in Music or a project in a video editor. Closing the window isn’t always enough; some apps keep the file open until you quit them.
- Spotlight is indexing the drive. When you plug in a drive, Spotlight reads it to build its search index. On a big drive that can take a while, and the drive stays busy until it finishes.
- Time Machine is backing up. If the drive is your backup disk, wait for the backup to finish, or stop it from the Time Machine menu in the menu bar.
- A Terminal window is sitting in a folder on the drive. If you ran
cd /Volumes/Backupearlier, that shell keeps the drive busy. Typecd ~or close the window. - A Quick Look preview is showing a file from the drive. Close it and try again.
Find the app with Terminal
Terminal can list every open file on the drive. Replace Backup with your drive’s name as it appears under /Volumes. Put the path in quotes if the name has spaces.
lsof +D "/Volumes/Backup"
+D searches the whole folder tree, so on a large drive it can take a minute. Faster:
lsof | grep "/Volumes/Backup"
The first column is the process name and the second is its PID (process ID). Without sudo, lsof only shows your own processes. Run it with sudo (you’ll be asked for your Mac password) to also see system processes such as Spotlight’s mds_stores:
sudo lsof +D "/Volumes/Backup"
You can also ask macOS to eject from Terminal. When it fails, diskutil often prints the PID of the process that refused:
diskutil eject "/Volumes/Backup"
Find the app with Activity Monitor
Activity Monitor (in Applications > Utilities) can’t search by drive, but it can confirm a suspect. Select the app, click the Info button (the “i” in the toolbar), and open the Open Files and Ports tab. Any path that starts with /Volumes/Backup means that app is holding the drive. Quit it normally from its own menu so it can ask you to save.
If Spotlight keeps the drive busy
If lsof shows mds, mds_stores or mdworker, Spotlight is reading the drive. You can wait, or stop it from indexing that drive. Add the drive to Spotlight’s privacy list in System Settings (in recent macOS it’s under Spotlight > Search Privacy; older versions put it under Siri & Spotlight > Spotlight Privacy). In Terminal, this turns indexing off for one drive:
sudo mdutil -i off "/Volumes/Backup"
Finder searches won’t find files on that drive afterwards.
What force eject risks
After a failed attempt, Finder may offer Force Eject. It works, but whatever the busy app was doing stops in the middle. A file being written can end up incomplete, an open document can fail to save, and a drive formatted as exFAT or FAT32 (common on drives shared with Windows) has no journal to recover with, so its file system can be damaged. APFS and Mac OS Extended drives recover better, though files still being written are still at risk. Pulling the cable has the same risks.
Force eject only when you know the app holding the drive isn’t writing anything, such as a frozen app you’ve already lost work in.
What MACdrive shows instead
MACdrive is an external drive app for Mac: see what blocks eject, check SMART health and speed, scan space and copy with verification.
Its Eject External Drives screen lists every drive. A drive that nothing is using is marked ready to eject and goes in one click. A busy drive shows how many processes are using it and how many files and folders they have open, with each app’s name and PID.
- Quit Safely asks only that app to quit, the normal way, so it can ask you to save. MACdrive checks again that the same process still holds the same drive before it asks.
- Force Quit is there for a frozen app. It warns you first that unsaved work in that app will be lost.
- Eject All (safe) ejects every external drive no app is using and skips busy ones. Nothing is forced. It needs a second click, so a stray click ejects nothing.
You can eject from the menu bar without opening the window. There’s also an optional setting that unmounts idle drives before the Mac sleeps, so unplugging a sleeping Mac is safe. It’s off by default.
Questions
Why does my Mac say a disk is in use when nothing is open?
A background process usually has a file open: Spotlight indexing, Time Machine, or an app that keeps files open after you close the window. sudo lsof +D "/Volumes/<name>" lists them by name.
Is it safe to force eject an external drive?
It’s safe only when nothing is writing to the drive. Force eject stops the busy app mid-task, so files being written can end up incomplete, and exFAT or FAT32 drives can be damaged.
How do I see which app is using my external drive?
Run lsof | grep "/Volumes/<name>" in Terminal, or check an app’s Open Files and Ports tab in Activity Monitor. MACdrive lists the app and its PID next to each busy drive.
Does MACdrive ever force a drive out?
No, not unless you ask. Eject All skips busy drives, and Force Quit only runs after you confirm a warning.
MACdrive is $6, paid once, with a year of updates, or $22 for all six Simpel apps. See MACdrive
