opensnoop tracks files opens on a Mac from the command line. As a process issues a file open, details such as UID, PID and pathname are printed out.

# -n process name to snoop
sudo opensnoop -n mdworker