OS X lacks linux strace , but has dtrace , which should be much better.
However, I am missing out on the simple tracking of individual teams. For example, in linux, I can write strace -f gcc hello.c to caputre all system calls, which gives me a list of all the file names that the compiler needs to compile my program (an excellent memoize script is built on this trick)
I want to port memoize to mac, so I need some kind of strace . I really need a list of gcc files to read and write, so I need more truss . Of course, I can say dtruss -f gcc hello.c and get somewhat the same functionality, but then the compiler starts with root privileges, which is clearly undesirable (besides the huge security risk, one problem is that the a.out file now belongs root :-)
Then I tried dtruss -f sudo -u myusername gcc hello.c , but this seems a bit wrong and does not work anyway (I do not get the a.out file all the time, I don’t know why)
This whole long story tries to motivate my initial question: how do I get dtrace to run my command with normal user privileges, just like strace does on linux?
Edit: it seems that I'm not the only one wondering how to do this: question # 1204256 is pretty much like mine (and has the same suboptimal answer sudo :-)
root dtrace strace macos
Gyom Jun 09 2018-10-06T00: 00Z
source share