How can I redirect OS X dtruss output when running with sudo?
I'm running dtruss
on Mac OS X 10.9. Simple example is:
sudo -c ls
But I'd like to capture the dtruss
output into a file. I saw something that suggests that I can do something like:
sudo bash -c 'dtruss -c ls >x'
but when I do this the output of dtruss
still goes to the terminal and the list of file from ls
gets redirected to the file.
How can I redirect the output of dtruss
to a file?
Solution 1:
I've been running it like this:
sudo dtruss -f -p 12345 2> /tmp/trace.txt
-
-f
says to follow child processes. -
-p
specifies which process ID to trace. -
12345
is a placeholder for a process ID. You could get that by looking attop
orps -A
. -
2>
pipes standard error into the output file. For some reason dtruss outputs everything on stderr.