Installing gprof on Mac


I would like to install GNU Profiler (gprof) on Mac. I tried to install binutils using Homebrew; however, the package that Homebrew installs from the following address does not have gprof.

According to binutils website, it should have gprof in it.

Any suggestion for installing gprof is welcome.

Best Answer

If you run brew install -v binutils, you will see this output flying by:

*** This configuration is not supported in the following subdirectories:
     ld gas gprof
     (Any other directories should still work fine.)

In there is

  noconfigdirs="$noconfigdirs ld gas gdb gprof"
  noconfigdirs="$noconfigdirs sim target-rda"

So, gprof is not supported on OS X.

I think the preferred profiling tool is DTrace.