Is it safe to unplug an external drive from a Mac without ejecting? What Eject does and what happens if you skip it
Usually you get away with it, but it is not safe. macOS holds recently written data in memory for a few seconds before writing it to the drive, and Eject forces that write and closes every open file. Unplug without ejecting and the Mac shows "Disk Not Ejected Properly"; a file you just saved can be incomplete, and on an exFAT drive, or during a Time Machine backup, the whole volume can be left unreadable. APFS drives recover better. If the Mac refuses to eject because "one or more programs may be using it", the usual culprit is Spotlight indexing a new drive or an open Finder window.
- Is it safe to just unplug
- No. Usually fine, sometimes a corrupted file or volume.
- What Eject does
- Flushes pending writes, closes open files, unmounts the volume
- Highest risk
- exFAT or FAT32 drives, and any drive mid-backup or mid-copy
- Lowest risk
- APFS drive that has been idle for a minute
- Why it will not eject
- Spotlight indexing, a Finder window, Preview or Photos with a file open
- The process in charge
- diskarbitrationd mounts and unmounts; fseventsd and mds_stores are usual holders
What Eject actually does
When you save a file to an external drive, macOS does not necessarily write it to the drive that instant. It keeps recent writes in a memory cache and sends them to the disk a moment later, in batches, because that is much faster. The drive's own electronics do the same thing with their own cache. At any moment, there may be a few seconds of data that the Mac believes is on the drive but is not there yet.
Eject (the button in the Finder sidebar, ⌘E with the drive selected, or dragging it to the Trash) does three things in order. It flushes every pending write to the drive. It asks every app with a file open on the drive to close it, and refuses to continue if one will not. Then it unmounts the volume, marking the file system as cleanly closed. The whole thing is managed by diskarbitrationd, the process that notices drives being plugged in and handles mounting and unmounting. When Eject finishes, the icon disappears and the drive is safe to pull.
Unplugging skips all three. Anything still in the cache is lost. Any file that was half-written is left half-written. And the file system is marked as not cleanly closed, which is what the next mount has to repair.
What happens if you unplug without ejecting
Most of the time, nothing visible. If the drive had been idle for a minute, the cache was already flushed and no file was open, so the only consequence is the "Disk Not Ejected Properly" notification. That message is macOS telling you it did not get to do the clean shutdown; it is not telling you something broke.
The risky moments are when the drive is busy:
- You just saved or copied something. The last few seconds of that file may not have reached the drive. The file looks present but is truncated or corrupt.
- Time Machine is backing up. backupd writes thousands of small files and updates the backup's database continuously. Pulling the drive mid-backup can corrupt the backup set; Time Machine often repairs it on the next run, but sometimes it has to start a new backup from scratch.
- Spotlight is indexing. mds_stores writes its index onto the drive itself (in a hidden folder). Unplugging mid-index corrupts the index, which is harmless but means it starts again next time.
- The drive is exFAT or FAT32. These formats keep their file allocation table in a few critical blocks and have no journal. If the pull lands during a write to those blocks, the entire volume can become unreadable, not just one file. This is the common Windows-compatible format for drives sold in stores, and the case where "it has always been fine" eventually is not.
APFS and HFS+ (Mac OS Extended) are journaled: the file system keeps a log of what it was about to do, and replays or discards it on the next mount. A pulled APFS drive almost always mounts cleanly next time with only the in-flight file affected. That is a good reason to format a Mac-only drive as APFS. It is not a reason to skip ejecting, because the in-flight file is still lost.
"The disk wasn't ejected because one or more programs may be using it"
This is the message you get when step two of Eject fails: some process still has a file open on the drive, and macOS will not pull the volume out from under it. Finding which one is the whole game, and it is usually one of these.
- Spotlight, on a drive you plugged in recently. When a new drive is connected, Spotlight starts indexing it, and the indexer holds files open the whole time. This is the most common cause on a drive you have used for less than an hour, and one MacRumors user solved a stubborn case this way: "Just for the heck of it I added one of the drives to Spotlight Privacy and now it ejects without any error messages." The setting is System Settings, Spotlight, Search Privacy; drag the drive in. Spotlight then ignores it, which is fine for a backup or media drive you do not search.
- A Finder window showing a folder on the drive. Close it. Finder keeps the folder open for as long as the window is.
- Preview, QuickTime, Photos, Music, or any app with a document from the drive open. Close the document or quit the app. Photo and video editors are the usual ones; a MacRumors reply on an identical thread: "If any Adobe apps are open make sure you quit them before you attempt to eject any attached storage."
- Terminal with its current directory on the drive. Type
cdand press Return, or close the window. - Time Machine mid-backup. Wait for it, or click Skip This Backup in the Time Machine menu, then eject.
- A file sync app (Dropbox, Google Drive) with a folder on the drive. Pause syncing.
- fseventsd. fseventsd keeps a change log on every mounted volume. It is a normal holder and releases the moment the real holder (one of the above) is gone.
The technical way to find the holder is the Terminal command lsof followed by the drive's path (lsof /Volumes/MyDrive), which lists every process with a file open there. It needs no special privileges for your own processes, and the command column names the app. Most of the time, though, closing Finder windows and quitting the obvious app is faster than reading the output.
Disk will not eject: what to check, in order
- 1Eject fails: "one or more programs may be using it"
- 2Any Finder window open on the drive? Close it, try again
- 3Preview, Photos, a video or photo editor, Music, or Terminal with a file or folder on the drive? Quit it, try again
- 4Time Machine backing up, or Dropbox or Google Drive syncing to it? Wait, or Skip This Backup, pause sync
- 5Drive plugged in less than an hour ago? Spotlight is indexing it. Wait a minute, or add it to Spotlight Search Privacy
- 6Still stuck and the drive is idle (no copy, no backup)? Force Eject
- 7Not idle, or unsure? Log out, or shut down, then unplug
How to eject a drive that will not eject, in order
- Close Finder windows on the drive
Any window showing a folder on the drive holds it open. Close them all, then try Eject again.
- Quit apps with a document from the drive
Preview, Photos, video and photo editors, Music, and anything you opened from the drive. ⌘Q each one, then Eject.
- Check Time Machine and sync apps
If Time Machine is backing up to this drive, let it finish or choose Skip This Backup from its menu bar icon. Pause Dropbox or Google Drive if they sync a folder here.
- Wait a minute if the drive is new
Spotlight indexing a freshly connected drive usually finishes within minutes for a small drive. If it is a large drive you never search, add it to Spotlight's Search Privacy list instead.
- Find the holder with lsof
In Terminal:
lsof /Volumes/followed by the drive's name. The first column names the app. Quit that app. - Force Eject only when the drive is idle
When Eject fails, macOS offers Force Eject. Use it when nothing is copying, no backup is running, and you have tried the steps above. Expect the "Disk Not Ejected Properly" notice and nothing worse.
- Last resort: log out, or shut down
Logging out closes everything you had open on the drive. Shutting down unmounts every drive cleanly, so the drive is safe to pull once the Mac is off.
Is Force Eject safe?
Force Eject unmounts the volume even though something has a file open on it. It is safe in the common case where the holder is Spotlight, Finder or fseventsd: those are reading, not writing, and nothing is lost. It is not safe when the holder is writing: a copy in progress, a backup, an export saving to the drive. In that case Force Eject is exactly as risky as pulling the cable, because the half-written file is abandoned.
The test is simple. Look at the drive's activity light if it has one, check that no copy progress window is open, and check the Time Machine icon is not animating. If the drive is idle, Force Eject is fine. If you cannot tell, quit the likely app first, or log out. Howard Oakley's advice on the Eclectic Light blog is the right order: find what is holding the volume before you force anything, because forcing it is only harmless when you know what you are about to interrupt.
APFS vs exFAT: which drive survives a pull
If you move a drive between a Mac and a Windows PC, it is probably exFAT, and exFAT is the format most likely to be ruined by an unclean unplug. It has no journal and no second copy of its allocation table, so a pull during a write to the wrong block takes the volume with it. Disk Utility's First Aid can sometimes repair it; sometimes the only fix is to erase and start again from a backup.
If the drive is used only with Macs, format it as APFS (Disk Utility, Erase, Format: APFS). APFS is journaled and copy-on-write, so a pulled drive comes back to the last consistent state on the next mount. Only the file being written at that moment is affected. Time Machine drives should be APFS on any Mac running Big Sur or later for the same reason.
Regardless of format: eject. It costs two seconds, it is the only step that guarantees the cache is flushed, and it is the difference between "Disk Not Ejected Properly" being a notification and being a problem. If a drive refuses to eject every single time and lsof keeps naming Spotlight, add the drive to Search Privacy and the problem goes away for good.
What people hit, in their words
“This happens every time I try ejecting, so I always have to force eject.”
“lsof should be of help in figuring out what files on your external disk are in use, and by what app.”
“I force quit all applications - nothing.”
“Just for the heck of it I added one of the drives to Spotlight Privacy and now it ejects without any error messages.”
Watch: ejecting a drive the right way
Mac Basics Tutorial: How To Eject Your External Drives On A Mac by Greg Toope. Independent channel. The basics, in two minutes.
Questions people ask
Is it okay to pull out a USB drive without ejecting on a Mac?
Not really, even though it usually works. macOS caches recent writes for a few seconds, and Eject is what flushes them and closes open files. Pull the drive while idle and you get a Disk Not Ejected Properly notice and nothing else. Pull it while copying, backing up or saving, and the file can be corrupt; on exFAT or FAT32 the whole volume can be. Ejecting takes two seconds.
How do I safely remove an external hard drive from a Mac?
Click the eject icon next to the drive in the Finder sidebar, or select the drive on the desktop and press Command E, or drag it to the Trash. Wait until its icon disappears, then unplug. If macOS says a program is using it, close Finder windows on the drive, quit apps with files open from it, wait for any backup or copy to finish, and try again.
Why can't I eject my external hard drive because Finder is using it?
A Finder window is open on a folder of the drive, or Finder is showing a Quick Look preview of a file there, or Spotlight (which Finder's search uses) is still indexing the drive. Close every Finder window on that drive and try again. If it still fails, relaunch Finder from the Force Quit window (Option Command Escape) and eject straight after. For a drive that does this every time, add it to Spotlight's Search Privacy list.
What does Disk Not Ejected Properly mean on a Mac?
A drive was disconnected without being ejected: you pulled the cable, a hub or dock lost power, or a flaky cable dropped the connection. If it happens when you did not touch anything, the cable, hub or the drive's power supply is the usual cause. The message itself means macOS could not flush and close the volume cleanly; it does not mean data was lost, but it is a sign to run First Aid in Disk Utility if it keeps happening.
Does unplugging a drive during Time Machine backup corrupt it?
It can. Time Machine writes many files and updates its database throughout a backup, and pulling the drive mid-backup can leave the backup set inconsistent. Often Time Machine repairs it on the next run; occasionally it reports the backup must be started fresh. Wait for the backup to finish, or choose Skip This Backup from the Time Machine menu bar icon, then eject normally.
Sources and further reading
- Apple Support: Eject a disk or storage device on Mac
- The Eclectic Light Company: What to do when a volume can't be ejected or unmounted
- MacRumors Forums: The disk wasn't ejected because one or more programs may be using it
- MacRumors Forums: External drive will not eject
- Apple Support: File system formats available in Disk Utility