MacOS external drive unmount woes
Sometimes MacOS refuses to unmount an external drive. I find this is often the case if I’ve been transfering and/or processing large audio files of many GB in size. More often than not this is because some background MacOS process is still holding the file in memory, or referencing the file in some way.
I’ve found that these steps in a terminal often solve the issue:
- Find the blocking process
lsof +D /Volumes/YourDriveName
Note the process name and PID from the output. - Kill the process
kill -9 <PID>
Common culprits are QuickLook (QuickLook) and Spotlight (mds/mdworker). Using-9(SIGKILL) bypasses the process’s ability to ignore the signal. - Find your disk identifier
diskutil list
Look for your drive by size — it will appear asdisk2,disk3, etc. - Unmount the disk
diskutil unmountDisk /dev/diskN
ReplacediskNwith the identifier found above.