Note that there are some explanatory texts on larger screens.

plurals
  1. POHow can I get dtrace to run the traced command with non-root priviledges?
    primarykey
    data
    text
    <p>OS X lacks linux's <code>strace</code>, but it has <code>dtrace</code> which is supposed to be so much better. </p> <p>However, I miss the ability to do simple tracing on individual commands. For example, on linux I can write <code>strace -f gcc hello.c</code> to caputre all system calls, which gives me the list of <em>all</em> the filenames needed by the compiler to compile my program (the excellent <a href="http://www.eecs.berkeley.edu/~billm/memoize.html" rel="noreferrer">memoize</a> script is built upon this trick)</p> <p>I want to port memoize on the mac, so I need some kind of <code>strace</code>. What I actually need is the list of files <code>gcc</code> reads and writes into, so what I need is more of a <code>truss</code>. Sure enough can I say <code>dtruss -f gcc hello.c</code> and get somewhat the same functionality, but then the compiler is run with root priviledges, which is obviously undesirable (apart from the massive security risk, one issue is that the <code>a.out</code> file is now owned by root :-)</p> <p>I then tried <code>dtruss -f sudo -u myusername gcc hello.c</code>, but this feels a bit wrong, and does not work anyway (I get no <code>a.out</code> file at all this time, not sure why)</p> <p>All that long story tries to motivate my original question: <strong>how do I get <code>dtrace</code> to run my command with normal user privileges, just like <code>strace</code> does in linux ?</strong></p> <p>Edit: is seems that I'm not the only one wondering how to do this: question <a href="https://stackoverflow.com/questions/1204256/how-to-trace-a-program-from-its-very-beginning-without-running-it-as-root">#1204256</a> is pretty much the same as mine (and has the same suboptimal sudo answer :-) </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload