特定のアプリが触ったファイルを監視

@norio_nomura さんに教えてもらったことを忘れないための備忘録。

sudo fs_usage -f pathname <プロセスID>

とかするとこんな感じで出力される。

20:11:32  stat64            ple.Safari/Webpage Previews/FFEE0AA49397DF9D900BD8B88BA37224.jpeg    0.000003   Safari      
20:11:32  stat64            pple.Safari/Webpage Previews/FFEE0AA49397DF9D900BD8B88BA37224.png    0.000003   Safari      
20:11:32  statfs64          /Users/Stewie/Library/Caches/com.apple.Safari/Webpage Previews       0.000004   Safari      
20:11:32  statfs64          /Users/Stewie/Library/Caches/com.apple.Safari/Webpage Previews       0.000002   Safari      
20:11:32  fsctl             /Users/Stewie/Library/Caches/com.apple.Safari/Webpage Previews       0.000003   Safari      
20:11:32  lstat64           /Users/Stewie/Library/Safari/HistoryIndex.sk                         0.000025   Safari      
20:11:32  stat64            /Users/Stewie/Library/Safari/HistoryIndex.sk                         0.000004   Safari      
20:11:32  open              /Users/Stewie/Library/Safari/HistoryIndex.sk                         0.000012   Safari      
20:11:32  open              orks/CoreFoundation.framework/Versions/A/Resources/tokruleLE.data    0.000022   Safari      
20:11:32  stat64            /usr/lib/libmecab.1.0.0.dylib                                        0.000007   Safari      
20:11:32  open              /usr/lib/libmecab.1.0.0.dylib                                        0.000011   Safari      
20:11:32  close                                                                                  0.000005   Safari      
20:11:32  stat64            /usr/share/tokenizer/ja                                              0.000007   Safari      
20:11:32  open              /Users/Stewie/.mecabrc                                               0.000016   Safari