Thrum

How do you find which process has a file open on a Mac?

Last reviewed: 19 November 2026.

In Terminal, run lsof followed by the file's path: it lists each process with that file open, with its name, PID and user. For a disk that will not eject, run lsof on the disk's path under /Volumes, and add sudo to include processes owned by root.

What are the steps?

  1. Get the path. In Terminal, type lsof and then drag the file or folder from Finder into the Terminal window; Terminal fills in the path.
  2. Run it. Press Return. Each line shows COMMAND (the process name), PID, USER and the file. No output means no process you own has it open.
  3. Include system processes. Run it again with sudo in front and your administrator password to include root and other users' processes.
  4. Release the file. Quit the app named in the COMMAND column, or close the document in it. Run lsof again to check.

How do you find what is stopping a disk from ejecting?

lsof /Volumes/MyDrive
sudo lsof /Volumes/MyDrive
lsof +D ~/Projects

Replace MyDrive with the disk's name. Common holders are Spotlight (mds and mds_stores) indexing a new disk, Time Machine (backupd), a Terminal window whose current folder is on the disk, and a document still open in an app. lsof +D searches a whole folder and everything in it, which can take a while on a large folder.

How do you see one app's open files in Activity Monitor?

Double-click the process in Activity Monitor and click Open Files and Ports. The list includes documents, libraries, caches and network connections. It answers the other question, which files one app has open, and needs no Terminal.

How can Thrum help?

Thrum's Disk tab shows read and write speed for the whole Mac and for each app.

Thrum is $4.99 once with a 14-day free trial and no account. It requires macOS 26 Tahoe on Apple silicon or Intel.

Questions

What do the letters in the FD column mean?

They describe how the file is used: cwd is the current folder, txt is program code, and a number followed by r, w or u is an open file read, written or both.

Why can I not delete a file that lsof shows is open?

On macOS you can usually delete it anyway; the disk space is freed when the last process closes it. Quitting the app is cleaner.

Sources