QCachegrind ( KCachegrind ) on Mac OS X

Simple instructions on how to install QCachegrind ( a.k.a KCachegrind ) on Mac OS X.

qcachegrind

Building KCachegrind on Mac OS X is a giant pain, most people I know using it will just fire up a Linux virtual machine instead.

Turns out there is another option. The KCachegrind repository includes QCachegrind, which is easy to build on Mac OS X once you have QT installed ( download 4.8.5 for Mac ).

8 Comments

  1. To clarify:
    1. Install Qt opensource for mac (browser for release at http://download.qt-project.org/official_releases/qt/4.8/4.8.5/)
    2. Add the following lines to .bash_profile
    export QTDIR=$HOME/Qt/5.4/clang_64
    export PATH=$QTDIR/bin:$PATH
    3. Clone repo
    git clone https://github.com/dtjm/kcachegrind.git
    cd kcachegrind/qcachegrind
    4. In new terminal (to make path above available) session build .app:
    qmake -spec ‘macx-g++’; make
    5. Launch qcachegrind.app

  2. You can use homebrew to do this:
    brew install qcachegrind

  3. Anupam — thanks for that! Love cachegrind, but hate building it — this is great.

    One thing — it looks like you still need to follow the instructions from https://gist.github.com/justfalter/1029580#file-how_to_install_qcachegrind_on_osx-txt about linking to dot if you want graphs:
    After installing dot (e.g.,
    brew install graphviz

    # By default, Graphviz installs dot to /usr/local/bin/dot, which qcachgrind.app
    # 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

  4. This does no longer work in OSX El Capitan due to System Integration Protection:
    sudo ln -s /usr/local/bin/dot /usr/bin/dot

    Workaround:
    $ cd /Applications/qcachegrind.app/Contents/MacOS
    $ mv qcachegrind qcachegrind.bin
    $ echo ‘#!/bin/bash
    export PATH=”$PATH:/usr/local/bin”
    $(dirname $0)/qcachegrind.bin
    exit 0’ > qcachegrind
    $ chmod +x qcachegrind

    Then start qcachegrind as usual.

  5. Good to know, thanks.

  6. Motin’s clever trick works (and I’m using macports, not homebrew), but keep in mind that you’ll have to convert the curly quotes that this blogging platform inserted back to standard quotes. This applies to both the single and double quotes. And of course you may have to proceed the “mv”, “echo” and “chmod” commands with “sudo “.

    Thanks!

  7. Thank you Motin! This one works for me on El Capitan.

  8. Note: If you copy pasted the line “export PATH=”$PATH:/usr/local/bin”” you might need to replace the quote characters.

Leave a Reply

Your email address will not be published. Required fields are marked *

© 2018 Joseph Scott

Theme by Anders NorénUp ↑