Skip to content
Edith

Docs

Command reference

What's Using This

What's Using This answers macOS's "the disk couldn't be ejected because one or more programs may be using it". It lists every process that holds a file, folder or volume open, grouped by app with the exact paths, quits or force quits what holds it, and ejects a volume or explains exactly what blocks it.

The ed command line

It has no command group of its own. Every action is an operation on the running extension through ed invoke, with a JSON payload and a JSON result on stdout. A refused request prints its reason on stderr and exits non-zero, as described in conventions.

Operation Payload What it does
volumes {} Lists mounted external, removable, ejectable and network volumes.
check {"path": "..."} Lists every process holding the file, folder or volume open.
eject {"path": "..."} Ejects a volume, or explains what blocks it.
quit {"pid": 4242} Asks the app that owns the process to quit, or sends it a terminate signal.
forceQuit {"pid": 4242, "confirm": true} Ends the process at once.
reveal {"path": "..."} Shows a file, folder or volume in Finder.
Terminal
ed invoke whatsUsing volumesed invoke whatsUsing check --json '{"path":"/Volumes/Backup"}'ed invoke whatsUsing eject --json '{"path":"/Volumes/Backup"}'ed invoke whatsUsing quit --json '{"pid":4101}'ed invoke whatsUsing forceQuit --json '{"pid":4103,"confirm":true}'ed invoke whatsUsing reveal --json '{"path":"/Volumes/Backup/Photos/Trail map.pdf"}'

Paths must be absolute; ~ is expanded. Unknown keys and values of the wrong type are rejected. Payloads are limited to 16 KiB.

check

A path that is a mount point is checked as a whole volume: every open file on that file system counts. A folder is searched recursively, and a file matches only itself. The startup disk cannot be checked, because it is always in use.

JSON
{  "fileCount": 3,  "groups": [    {      "bundlePath": "/System/Applications/Preview.app",      "id": "/System/Applications/Preview.app",      "otherUser": false,      "primaryPID": 4101,      "processes": [        {          "command": "Preview",          "executable": "/System/Applications/Preview.app/Contents/MacOS/Preview",          "files": [            {              "deleted": false,              "descriptor": "12",              "path": "/Volumes/Backup/Photos/Harbor at dusk.jpg",              "type": "REG",              "use": "reading"            }          ],          "otherUser": false,          "pid": 4101,          "ppid": 1,          "protected": false,          "uid": 501,          "user": "alex"        }      ],      "title": "Preview"    }  ],  "onlyYours": true,  "processCount": 2,  "target": { "kind": "volume", "name": "Backup", "path": "/Volumes/Backup" }}
  • target.kind is file, folder or volume.
  • groups holds one entry per app bundle, or per process name for processes outside an app. Apps come first, then other processes of the signed-in user, then processes of other users.
  • use is reading, writing, readWrite, workingDirectory, rootDirectory, program, mapped or other. A shell whose current folder is on the volume shows up as workingDirectory.
  • deleted is true for a file that was deleted while still open.
  • otherUser processes, such as Spotlight's mds_stores running as root, are listed whenever lsof can see them, but never quit.
  • onlyYours is true when the check ran without administrator rights. macOS then shows lsof only the signed-in user's processes, so system services and other accounts that hold the item are not listed.
  • An empty groups means nothing visible holds the item open.

eject

Runs diskutil eject for a mounted volume. When the eject fails, it checks the volume again and reports what holds it.

JSON
{  "dissenter": {    "pid": 4101,    "program": "/System/Applications/Preview.app/Contents/MacOS/Preview"  },  "message": "Backup is in use: Preview, TextEdit and 2 more are using it.",  "outcome": "blocked",  "path": "/Volumes/Backup",  "report": { "groups": [], "onlyYours": true, "target": {} }}

report has the same shape as the result of check; it is shortened here.

outcome is ejected, blocked (something holds the volume; report lists it and dissenter is the process macOS named, when it named one) or failed (the eject failed and nothing visible holds the volume any more; message carries the reason, and says when a system service Edith cannot see may still be using it). Running eject again after quitting the holders retries it. A path that is not a mount point is rejected.

quit and forceQuit

quit asks the app that owns the process to quit, the same as choosing Quit in the app, so the app can still ask to save changes. A process outside an app gets a terminate signal. forceQuit force quits the app when the process is the app itself and sends a kill signal otherwise; it needs "confirm": true because unsaved work is lost.

Both refuse processes of other users, process 1 and Edith itself, and both accept an optional "executable" that must still match the process, so a reused process ID is never quit by mistake, and an optional "name" used in the result message in place of the name Edith works out from the process.

JSON
{  "exited": true,  "force": false,  "message": "Preview quit.",  "method": "app",  "name": "Preview",  "pid": 4101,  "sent": true}

method is app or signal. exited is false when the process is still running after five seconds, for example while the app asks to save.

volumes

JSON
{  "volumes": [    {      "ejectable": true,      "internal": false,      "local": true,      "name": "Backup",      "path": "/Volumes/Backup",      "removable": false    }  ]}

The startup disk and system volumes are left out.