Installing gprof on Mac

homebrew

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.

http://ftpmirror.gnu.org/binutils/binutils-2.24.tar.gz

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

http://www.gnu.org/software/binutils/

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 configure.ac there is

*-*-darwin*)
  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.