{"slug": "why-can-t-i-eject-this-drive-finder-knows-and-it-will-not-say", "title": "Why can't I eject this drive? Finder knows, and it will not say", "summary": "A developer built PhantomTrace, an open-source macOS utility that identifies which processes are blocking a drive from being ejected, addressing Finder's unhelpful generic error. Invoked as a Finder Quick Action, it lists each holding process with its PID, user, lock type and file path, then offers a four-step, gentlest-first fix pipeline that rescans before and after each step. The MIT-licensed tool has no runtime dependencies or network code, and hard-codes protections against signaling system processes like launchd and WindowServer.", "body_md": "*This post was written as part of the Kiroween 2026 hackathon (Resurrection category), for my entry PhantomTrace.*\n\nYou finish a copy, you need the drive on another machine, and you drag it to the trash. Finder answers:\n\nThe disk wasn't ejected because one or more programs may be using it.\n\nThat is the whole message. It does not say which program, or which file.\n\nI hit this constantly. At any moment I have several terminals open, a couple of editors, a coding agent or two, a preview app, a backup tool. Somewhere in that pile, one thing has a file open on the drive, or a shell is sitting in a folder on it. Finder will not tell me which. Quitting everything is not an option, because each of those apps holds work I have not saved or a session I would have to rebuild. So a five-second job (unplug the drive, use it elsewhere) turns into a hunt.\n\n**The usual workarounds all have a cost**\n\n`lsof` in a terminal and read the output. It works, but the output is dense, the right flags are easy to forget, and a path with spaces or odd characters makes it harder to read.`kill -9`. Quick, but risky. You can kill the wrong process, and an app that was mid-write can leave the drive in a bad state.\nWhat I wanted was the old Mac answer. In the System 7 and Mac OS 9 era there were small single-purpose utilities, such as *What's Keeping Me?*, that answered one question and got out of the way. The hackathon's Resurrection category asked for exactly that kind of revival, so I built one for modern macOS.\n\n**What PhantomTrace does**\n\nRight-click the stuck drive in Finder and choose the Quick Action \"Why Can't I Eject?\". PhantomTrace lists every process holding the volume: its name, process ID, user, whether it is a working-directory lock or an open file, and the exact file path. Diagnosis is always free. Nothing is touched until you choose.\n\nIf you want it fixed, there is a four-step pipeline, gentlest first, and you pick each step:\n\n`cd ~` to idle terminal shells. The terminal session survives. An idle shell sitting in a folder on the drive is a common blocker when you work in terminals.\nIt rescans before and after every step, so it never acts on a stale picture. The point is that the thing keeping the drive busy is often a shell sitting in a folder, not an app doing real work, and you can fix that without closing anything.\n\nA few rules are fixed in code: it never signals `launchd`, `Finder`, `WindowServer` or similar, never touches protected volumes, and never leaves the machine. There is no network code and no telemetry.\n\n**How Kiro shaped it**\n\nThis is the part I would not have predicted before starting.\n\n`print` in the core library and no networking APIs.`/private/var/vm` slipped past the protected-volume check because a path-normalizing call rewrote it to `/var/vm`. I would not have written that test case by hand.\n**Try it**\n\nThe code is MIT licensed, with zero runtime dependencies, at [https://github.com/iolaire/PhantomTrace](https://github.com/iolaire/PhantomTrace). It builds with the Swift command line tools. The app is ad-hoc signed, not notarized, so build it from source. Use a throwaway disk image to try it, never a real backup drive. The `Scripts/demo/setup-demo.sh` script makes one with a held file and an idle shell. The demo video is at [https://youtu.be/P3He7COqWzA](https://youtu.be/P3He7COqWzA).\n\nNot done yet: notarization, and VoiceOver and Reduce Motion testing.", "url": "https://wpnews.pro/news/why-can-t-i-eject-this-drive-finder-knows-and-it-will-not-say", "canonical_source": "https://dev.to/iolaire/why-cant-i-eject-this-drive-finder-knows-and-it-will-not-say-1jhe", "published_at": "2026-12-03 14:11:37+00:00", "updated_at": "2026-12-03 14:14:30.250844+00:00", "lang": "en", "topics": ["developer-tools"], "entities": ["PhantomTrace", "Apple", "Finder", "macOS", "Kiro", "launchd", "WindowServer"], "also_reported_by": [], "takeaway": "Rescanning for file locks before and after each remediation step avoids acting on a stale process list, and the most common eject blocker is often an idle terminal shell sitting in a folder on the drive rather than an app doing real work.", "recommendation": {"advice": "Rescan lock holders before and after each remediation step, and start with the gentlest fix (cd idle shells home) before signaling processes, since stale state and idle shells are common blockers.", "playbook": "production-ops", "playbook_url": "https://wpnews.pro/playbooks/production-ops"}, "alternates": {"html": "https://wpnews.pro/news/why-can-t-i-eject-this-drive-finder-knows-and-it-will-not-say", "markdown": "https://wpnews.pro/news/why-can-t-i-eject-this-drive-finder-knows-and-it-will-not-say.md", "text": "https://wpnews.pro/news/why-can-t-i-eject-this-drive-finder-knows-and-it-will-not-say.txt", "jsonld": "https://wpnews.pro/news/why-can-t-i-eject-this-drive-finder-knows-and-it-will-not-say.jsonld"}}