Strace For Mac

  1. Strace For Mac Pro
  2. Strace For Mac Os
  3. Strace For Mac

I am running OSX desktops coming from Linux background. We cross-develop software both on OSX and Linux. I am familiar of debugging system issues on Linux using strace command and now I had to try something similar on OSX. strace prints out system calls a running application makes so you can see “inside” the application and see where it crashes, hangs, etc.

API Monitor is a Windows program that lets you monitor and control API calls made. Check out 50+ terminal commands for beginners using Linux and Mac OS X. These are extremely useful for DevOps and SysAdmins as well. The STRACE command. It is one of the Linux commands which allows watching a process execution. It intercepts the system calls and signals that a program exercises while running. Trace a program using its PID.

Strace for mac shortcut

OSX doesn’t have strace, but has its equivalent dtrace which originates from Solaris and I believe it has replaced OSX ktrace, truss etc. commands since OSX 10.5 Leopard.

Here are brief instructions how I tracked down a non-working Subversion svn up command. svn was correctly updating some repositories, but not others and just hung which means it probably hung on some system call.

Turns out dtrace itself is a very low level framework which its own programming language. I just want to dump the system calls. So there exist an utility called dtruss for this purpose.

Strace For Mac Pro

But the first attempt failed:

You could solve this by running dtruss as root, but we really don’t want to do that. You can enable normal user execution for dtruss / dtrace with the following command:

Now we dtruss get output:

Strace For Mac Os

… and there it hangs. Unknown command “failure”. In the end this all was not very helpful and I decided just selfupdate Macports and take clean checkout.

Strace For Mac

1. More info