Guides/Disk won’t eject
Mac won’t eject an external drive? How to find what is using it
Quick answer
A disk will not eject while any process has a file or a folder open on it. Quit the apps that used it, close Terminal windows sitting in its folders, and try again. If that fails, run sudo lsof /Volumes/NAME in Terminal to list every process holding it, and quit those. Spotlight and Time Machine let go by themselves, usually within a minute. Force Eject is the last resort, because a file being written can be damaged. Vitals, an activity monitor and process inspector for the Mac, lists every disk with the apps holding files on it, and its Quit Them and Eject quits them and ejects the disk once you confirm.
How to find what is using a disk with Terminal
- 01 Open Terminal, in Applications → Utilities.
- 02 Type
sudo lsofand a space, then drag the disk from Finder into the window to fill in its path, and press Return. - 03 Enter your password. Each line is one open file: the first column is the process, the second its PID, and the last the file.
- 04 Quit each app in the list. For a process with no window, run
kill <PID>with its PID. - 05 Eject the disk again in Finder, or run
diskutil ejectwith the same path.
If the list is empty and the disk still will not eject, wait a minute and try again: macOS may be finishing a write. mdutil -s with the disk’s path says whether Spotlight indexing is turned on for it.
macOS refuses to eject a disk in use because unmounting it under a program can lose whatever the program was writing. The message in Finder sometimes names the app and often does not. The table below matches the usual holders to what makes each one let go.
What keeps a disk from ejecting
| What holds it | How to tell | How to make it let go |
|---|---|---|
| An app with a document open | The app is in the lsof list, or Finder names it | Close the document, or quit the app |
| A Terminal window | A shell such as zsh in the list, with cwd in the FD column | Run cd ~ in that window, or close it |
| Spotlight | mds or mds_stores in the list | Wait, or add the disk under System Settings → Spotlight → Search Privacy |
| Time Machine | backupd in the list, or a backup under way in the menu bar | Let the backup finish, or choose Skip This Backup |
| Quick Look or Preview | QuickLookUIService or Preview in the list | Close the preview, or quit Preview |
| A Photos or Music library on the disk | Photos, photolibraryd or Music in the list | Quit the app and give its helpers a few seconds |
| An app that runs from the disk | The app’s own path is on the disk | Quit the app |
What the eject message means
Finder shows one of two messages. “The disk wasn’t ejected because one or more programs may be using it” means some process has something open on the disk, and macOS is not saying which. When it knows the app, the message names it instead. In both, Try Again is safe, and Force Eject unmounts the disk whatever is open.
Is Force Eject safe?
Force Eject unmounts the disk under the programs using it. Files that were only being read are not harmed. A file being written can be left incomplete, and a Photos, Music or Final Cut library that was open can need repair the next time you open it. Use it once you have found the holder and it will not quit, not before.
Ejecting with Disk Utility or diskutil
Disk Utility’s Unmount and Eject follow the same rule as Finder, and fail the same way while something holds the disk. In Terminal, diskutil eject /Volumes/NAME ejects a disk and diskutil unmountDisk force /Volumes/NAME forces it, with the same risk as Force Eject.
When nothing seems to be using it
Log out and back in, which quits every app and helper of yours, then eject. If that works, a background helper was holding the disk. Failing that, shut the Mac down and unplug the disk once it is off: shutting down unmounts every disk safely.
How to stop it happening
Most stuck ejects come from the same few habits.
- Quit the apps that opened files on the disk before you eject it
- Keep Terminal windows out of the disk’s folders, or close them first
- Add the disk to Spotlight’s Search Privacy if you never search it
- Let a Time Machine backup finish before you unplug its disk
What Vitals adds
Vitals names what is holding a disk, and ejects it for you.
- Open Files, in the Developer tab: every disk with how many files are open on it, and In Use or Ready to Eject
- Under a disk, each app and program holding it, with the folder it works in and the files it has open
- Quit Them and Eject: Vitals names the apps, asks, quits them as ⌘Q does, then ejects the disk
- Spotlight and Time Machine named for what they are doing, and tried again while they let go
Good to know
- Vitals does not force eject. If an app will not quit, it says which and leaves the disk mounted.
- Without Full System Metrics, the files of macOS’s own processes are left out, and Vitals says how many.
- Open Files is in the window, not in the menu bar dropdown.
Questions people ask
Why does my Mac say the disk wasn’t ejected because one or more programs may be using it?
A process still has a file or a folder open on the disk. It can be an app, a Terminal window, Spotlight or Time Machine. Run sudo lsof /Volumes/NAME to see which.
How do I find out which program is using my external drive on a Mac?
Run sudo lsof /Volumes/NAME in Terminal. Each line is a process and a file it has open on the disk. Vitals shows the same by app, in Open Files.
Is it safe to force eject a disk on a Mac?
Only if nothing is writing to it. Force Eject can leave a file incomplete or a library in need of repair. Find the holder and quit it first.
Can I just unplug the drive?
Not while it is mounted. macOS may still be writing, and the disk can need repair afterwards. Eject it, or shut the Mac down first.
Why is Spotlight using my external drive?
Spotlight indexes a disk so that it can be searched. It finishes by itself. To stop it for good, add the disk under System Settings → Spotlight → Search Privacy.
Is there an app that shows what is keeping a disk from ejecting?
Vitals does. Its Open Files section lists every disk with the apps holding files on it, and Quit Them and Eject quits them and ejects the disk after a confirmation.
In the glossary
More guides
- Why is my Mac so slow
- What’s draining my Mac’s battery
- Which app is using my CPU or memory
- Why won’t my Mac sleep
- Chrome using too much memory
- Why are my Mac’s fans so loud
- How to control fan speed on a Mac
- How to free up RAM on a Mac
- Docker using too much memory
- How to stop Docker containers
- Volume mixer for Mac
- Cursor using high CPU
- Claude Code using too much memory
- Claude Code and Codex usage limits
- Claude app using high CPU
- Codex using high CPU
- Ollama using too much memory
- Vitals over SSH
- Which app is using a file
- Activity Monitor alternatives
- iStat Menus alternatives
- Stats alternatives
- Task Manager for Mac
- Best system monitors for Mac
- Best menu bar monitors for Mac
- Best volume mixers for Mac
- htop for Mac
- Process Explorer for Mac
- Best process monitors for Mac
- Best temperature monitors for Mac