Archive for April, 2013

Linux strace like command for Mac OS X (with Dtrace)

On Linux I use the strace command a lot to find out what a kernel calls a binary is executing internally; on Mac OS X this does not exist. In OS X you have, instead, the very powerful, but less easy to use dtrace tool (originally made by Sun for Solaris).

So here is a simple script to get that strace feel under OS X with dtrace:

#!/bin/sh
dtruss -f -t open $@

I put it in /usr/sbin/strace, but anywhere in your path or where it is convenient will do. You need root perms to run it.