MacAppKit Guides

"Disk can't be ejected because it's in use" on Mac: how to fix it

You click Eject and macOS answers: "The disk wasn't ejected because one or more programs may be using it." It offers Force Eject but not the name of the program. The message means some process still has a file or folder open on that drive. Ejecting anyway risks damaging files that are being written, so the goal is to find that process and end it politely. Here are the steps, from simplest to most direct.

1. Close the obvious things first

Quit apps that may have files on the drive: Preview, Photos, Music, Final Cut or Premiere, Lightroom, Office apps, a Terminal window whose current folder is on the drive, and Finder windows or Quick Look previews showing it. A Terminal tab sitting in /Volumes/MyDrive blocks ejecting. Then try again.

2. Check for copies and background indexing

If a copy is still running, wait for it. Two macOS services often hold a drive without any visible app:

3. Find the process with Terminal (lsof)

This is the reliable way to name the culprit. Open Terminal and list open files on the volume. Replace MyDrive with the drive's name:

lsof /Volumes/MyDrive

With a volume path, lsof lists every process that has a file open anywhere on that file system. Read the COMMAND and PID columns, plus NAME for the file. Example output:

COMMAND PID USER FD TYPE NAME
Preview 1234 you txt REG /Volumes/MyDrive/report.pdf

There is also the form lsof +D /Volumes/MyDrive. It walks every folder under that path, finds the files open there, and can be very slow on a big drive; the first command is usually quicker and enough.

Without sudo, lsof only shows processes you own. Add sudo to see system processes, such as mds (Spotlight), fseventsd or backup services: sudo lsof /Volumes/MyDrive.

4. Quit that process

Prefer quitting the app normally, so that it can ask you to save. If it will not quit, from Terminal you can ask it to terminate:

kill 1234

That sends a polite terminate signal. Only use kill -9 1234 if nothing else works, because it does not allow the app to save or clean up. Do not kill system processes unless you know what they do; stop Spotlight or Time Machine in the ways above instead.

5. Eject from Terminal

Once nothing is holding the drive, eject in Finder, or use diskutil. First find the disk:

diskutil list external

Then eject the whole disk (replace disk4 with yours):

diskutil eject /dev/disk4

The command diskutil unmountDisk force /dev/disk4 forces it. Force is the last resort, since unsaved data can be lost and the drive may need repair the next time you connect it.

6. If it still refuses

Without Terminal: Heldup

Heldup is a free menu bar app from the MacAppKit team that automates steps 3 to 5. It lists your external drives, SD cards, disk images and network shares with a one-click Eject. When macOS refuses, Heldup shows each app by name and icon, how many files it has open and an example path. Click Quit App and it asks the app to close politely, then ejects again by itself. It needs no admin password, no helper tool and no Full Disk Access, so it only sees programs running under your own account. When a macOS system process holds the drive, it says so plainly, explains what it is, and does not offer to force-quit it.

Heldup is free in exchange for one anonymous weekly report you agree to when you first open it. It requires macOS 13 or later and runs on Apple silicon and Intel.

HeldupFree menu bar app for Mac, made by the MacAppKit team. No account, no ads.
Get Heldup (free)

More from the same team

If you are tidying a Mac, the MacAppKit team also makes Sweepvault, which cleans only junk that is certainly safe, shows everything first and keeps a 30-day undo vault, and Uptend, which finds updates for the apps on your Mac, including direct downloads, Homebrew and the App Store.