macOS Debug System Calls Made by a Program
If you want a quick way to see some details of your running application say as calls to the file system you can use dtruss
:
Using process name:
$ sudo dtruss -d -n 'node' > /tmp/process.txt 2>&1
Using process id (pid):
$ sudo dtruss -d -p 345234 > /tmp/process.txt 2>&1
The output looks similar to this:
36734/0x22974d: 53236 stat64("/Users/peperone/application-core/node_modules/gkeypath\0", 0x7FFEEFBFAE80, 0x0) = 0 0
36734/0x22974d: 53243 stat64("/Users/peperone/application-core/node_modules/gkeypath.js\0", 0x7FFEEFBFADB0, 0x0) = -1 Err#2
36734/0x22974d: 53247 stat64("/Users/peperone/application-core/node_modules/gkeypath.json\0", 0x7FFEEFBFADB0, 0x0) = -1 Err#2
36734/0x22974d: 53250 stat64("/Users/peperone/application-core/node_modules/gkeypath.node\0", 0x7FFEEFBFADB0, 0x0) = -1 Err#2
36734/0x22974d: 53253 stat64("/Users/peperone/application-core/node_modules/gkeypath.mjs\0", 0x7FFEEFBFADB0, 0x0) = -1 Err#2
36734/0x22974d: 53284 open("/Users/peperone/application-core/node_modules/gkeypath/package.json\0", 0x1000000, 0x0) = 36 0
36734/0x22974d: 53339 close_nocancel(0x24) = 0 0
36734/0x22974d: 53437 stat64("/Users/peperone/application-core/node_modules/gkeypath/src/keypath\0", 0x7FFEEFBFAD80, 0x0) = -1 Err#2
36734/0x22974d: 53445 stat64("/Users/peperone/application-core/node_modules/gkeypath/src/keypath.js\0", 0x7FFEEFBFAD10, 0x0) = 0 0
36734/0x22974d: 53482 lstat64("/Users/peperone/application-core/node_modules/gkeypath\0", 0x7FFEEFBFAB50, 0x0) = 0 0
36734/0x22974d: 53490 lstat64("/Users/peperone/application-core/node_modules/gkeypath/src\0", 0x7FFEEFBFAB50, 0x0) = 0 0
36734/0x22974d: 53498 lstat64("/Users/peperone/application-core/node_modules/gkeypath/src/keypath.js\0", 0x7FFEEFBFAB50, 0x0) = 0 0
36734/0x22974d: 53610 open("/Users/peperone/application-core/node_modules/gkeypath/src/keypath.js\0", 0x1000000, 0x1B6) = 36 0