Force eject/unmount in Disk Utility

Sometimes in Disk Utility when I try to unmount a volume I get this message:


Sometimes I'm not doing anything in those disks/volumes. Maybe it's something in the background still writing to them, but not me copying/deleting/changing files or folders.

Is there a way to force any "connection" to be "disconnected"?
I remember a few years ago I saw something online (can't find it now) where there was a way via the Terminal that would show some information about these "connections" and it would give us an "ID" or something like that and then we could force those connections to disconnect. It wouldn't always work though.

Any tips?

The command is, I believe, diskutil eject name_of_disk, but it probably won't work for a drive that generates the Finder message. You can get the name of all disks via diskutil list external.

You can use lsof to find out what's making the drive non-ejectable: sudo lsof /Volumes/name_of_disk. Most likely, you'll find that it's QuickLook, which has a nasty habit of staying open after being used. To fix that, you can either use QuickLook on a file on your internal drive, or use ps ax | grep QuickLook and then kill the QuickLook processes, but I wouldn't recommend this method.


1 Like

But wouldn't this eject the whole disk? Sometimes I just want to eject a volume, not all volumes.

I didn't know that. Thanks for mentioning it and I will definitely try this trick next time.

So if I use sudo lsof /Volumes/name_of_disk I get this (this is just a flash drive I have and I was just testing)

So let's say I wanted to quit everything. Would I be able to do it with KM?

If you look at the output of diskutil list external, you should see that volumes are given their own identifiers. None of my externals are set up like that, but my internal is:

   1:                APFS Volume UltraSSD                9.3 GB     disk3s1
   7:                APFS Volume workSpace               30.0 GB    disk3s7

Those are two volumes on one physical disk, but you can see that each is given a virtual identifier: disk3s1 and disk3s7. So you can easily eject just a specific volume.

Honestly, I don't have any idea. That looks to me like Spotlight is indexing the disk, which probably isn't a process you want to force quit. But I don't know for sure; the intricacies of what's going on in the Unix core of macOS is above my pay grade :).


Have a look at Jettison written by StClairsoft. Not expensive.

1 Like

So I guess in this case I would use something like this:
diskutil eject disk3s1 (assuming that was the identifier, of course)

This was just a flash drive I connected just to see what content it would show using sudo lsof.
But I will see what I come up with when I experience that issue again.

Thanks :slight_smile:

Thanks for the suggestion.
I actually saw that before and I need to contact the developer to ask a few questions.

I think you need to include the /dev directory:

sudo diskutil unmount /dev/disk3s1


1 Like

Thanks. I will try that then :+1: