Instantly share code, notes, and snippets.

What would you like to do?
How to install qcachegrind (kcachegrind) on OSX Snow Leopard
I like to use kcachegrind for doing profiling on my ruby code. Most of my development
is done on OSX, and while you can install kcachegrind via macports, it takes forever
because it has to build KDE, as well. Much to my surprise, the fine folks who
wrote kcachegrind also made a QT version, qcachegrind. I was able to build this on
OSX without too much effort, only having to install QT and GraphViz. Yippie!
I'm running OSX 10.6.7, with Xcode 4. My default gcc/g++ version is 4.2. I'm sure
it will build just fine on earlier versions of Xcode, but I haven't tested it.
### Download and install QT
# I installed 4.7.3 on for 10.5/10.6 from here:
### Download and install Graphviz
# If you don't already have graphiviz (specifically the 'dot' binary), then
# install it. This is so that you can see the pretty call graphs that
# qcachegrind likes to draw.
# By default, Graphviz installs dot to /usr/local/bin/dot, which
# might not find since /usr/local/bin isn't in PATH by default (I think). In order
# to ensure that my graphs render, I created a symlink from /usr/bin/dot to /usr/local/bin/dot:
sudo ln -s /usr/local/bin/dot /usr/bin/dot
### Building qcachegrind
svn co svn:// kcachegrind
cd kcachegrind/qcachegrind
# qcachegrind will only let you open up files named "callgrind.out*". Since
# I'm an adult, I created a patch that allows me to open up any file.
# You can grab the patch from this gist.
patch -p0 < qcachegrind_filename_filter.patch
# By default, qmake wanted to build an xcode project on my box. I pointed
# it at spec profile that builds using g++, and things seemed to work fine.
# You can see all the profiles available in this directory: /usr/local/Qt4.7/mkspecs
# This also managed to spit out a whole bunch of errors and warnings, yet
# everything seemed to build properly.
qmake -spec 'macx-g++'
# It should have generated ''. You can put this in
# /Applications, or you can just open it directly.
--- qcgtoplevel.cpp (revision 1237008)
+++ qcgtoplevel.cpp (working copy)
@@ -795,7 +795,7 @@
file = QFileDialog::getOpenFileName(this,
tr("Open Callgrind Data"),
- tr("Callgrind Files (callgrind.*)"));
+ tr("Callgrind Files (*)"));
@@ -842,7 +842,7 @@
file = QFileDialog::getOpenFileName(this,
tr("Add Callgrind Data"),
- tr("Callgrind Files (callgrind.*)"));
+ tr("Callgrind Files (*)"));

This comment has been minimized.

bucha commented Mar 1, 2013

Seems like they moved from SVN to GIT:
git clone git://


This comment has been minimized.

bogdanmt commented Mar 6, 2013

FYI, especially for Mac users:

  1. Yes, they moved to Git, that's the link. Thank you man for posting it!
  2. The patch is no more required, because they offer now the choice "All Files () / Callgrind Files (callgrind.)" when you open files.
  3. For Mac OS X you can use QT and Graphviz binaries (there is no need of mac ports or brew); just don't forget to create that symbolic link for Graphviz.

This comment has been minimized.

schmunk42 commented Oct 8, 2013

Thanks guys! I was able to build it in minutes on 10.7.5 with

git clone git://
cd kcachegrind/qcachegrind
qmake -spec 'macx-g++'; make

Copy generated to your Applications folder.



This comment has been minimized.

MikeiLL commented Aug 13, 2014

Very helpful. Thank you. Took me a minute to figure out moving the Ended up just doing it by locating the file with spotlight and option-dragging into Applications folder 'cause I couldn't remember where I had saved it and was having trouble finding it with grep - name...


This comment has been minimized.

ghost commented Sep 1, 2014

Hi guys. Would it be possible for someone to provide the compiled binaries?


This comment has been minimized.

rchrd2 commented Aug 18, 2015

The QT link is no longer valid. Here is a new link:


This comment has been minimized.

stratagem-admin commented Jun 8, 2018

A couple other changes for qmake:

You probably won't find this in the path anymore. On my system it ended up in /usr/local/Cellar/qt/5.11.0/bin
Do not run it using the -spec. This is outdated and no longer supported. Simply run qmake followed by make

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment