I'm debugging the initialization of a program (on a mac) and would I'd like to get a list of all the files opened during the execution, preferably in time order. Can this be done?



And I need some more characters in this box, but I'm not sure what else to say...

  • This does what I want (although the -w option doesn't work). – eaubin Sep 29 '10 at 2:46

You should be able to use lsof.

  • I can use the lsof -r option, but there's no certainty that I'll get the whole set of files opened. – eaubin Sep 29 '10 at 0:33
  • @eaubin: You might be able to use ktrace. – Dennis Williamson Sep 29 '10 at 0:42
  • 1
    Turns out ktrace isn't available on my machine, but dtrace can do it: sudo dtrace -s /dev/stdin syscall::open*:entry { printf("%s %s", execname, copyinstr(arg0)); } Ctrl-D (from hints.macworld.com/article.php?story=20071031121823710) – eaubin Sep 29 '10 at 11:53

Fseventer gives a nice visual representation.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.