Getting files back
Pulling the cable works until the day it corrupts the drive. The eject error has a specific cause every time — a process with a file open on that volume — and macOS will name it if asked properly.
lsof /Volumes/DriveName
Every process with anything open on the drive, listed. Quit those apps and eject again. If the list is long, the last-opened app with documents on that drive is usually the one that matters.
macOS indexes drives as they mount, and mds holding index files open blocks ejection with no visible app running. Check and stop it:
mdutil -s /Volumes/DriveName
mdutil -i off /Volumes/DriveName
For archive drives that plug in rarely, indexing restarts from scratch each time and rarely finishes — turning it off for those volumes ends both the eject fights and the pointless background churn. (Third-party index-based search tools keep their own records of offline drives precisely because of this.)
diskutil unmount /Volumes/DriveName
reports failures with more detail than Finder. The escalation:
diskutil unmountDisk /dev/disk4
diskutil unmountDisk force /dev/disk4
(diskutil list shows which disk number is which.) Force is the last resort before cable-pulling — it abandons open files but flushes what can be flushed, which unplugging does not.
A backup tool, antivirus scanner, or sync client configured to watch the drive will hold it perpetually. lsof shows the same name each eject; exclude the volume in that app's settings and the problem ends permanently.
It abandons any writes in flight, risking the files being written. It is safer than pulling the cable and worse than quitting the holder.
If the drive is a backup destination, backups hold it while running. Wait for completion or skip the backup in the Time Machine menu.
Everywhere keeps track of every file on your Mac — including the folders Spotlight hides and drives you have unplugged. Free for a day, then $19 once.
Download for MacVersion 2.15.7 · macOS 13+ · 3.8 MB · notarised