How to Install Valgrind on macOS High Sierra

Share Tweet

Valgrind is a programming tool for memory debugging, memory leak detection and profiling. Its installation for macOS High Sierra seems problematic and I wanted to write this post to tell the solution that worked for me. I use Homebrew to install it which is the recommended way and the solution also uses it.

Valgrind

So, when you try installing right away, you may get the following error:

$ brew install valgrind
valgrind: This formula either does not compile or function as expected on macOS
versions newer than Sierra due to an upstream incompatibility.

1. To correctly install it, first, type the following command at the Terminal (which opens Valgrind’s formulae)

brew edit valgrind

And change the URL in head section

https://sourceware.org/git/valgrind.git

to

git://sourceware.org/git/valgrind.git

Solution from this post.

2. Do an update for Homebrew:

$ brew update

3. Finally, use the following command to install Valgrind from the HEAD:

$ brew install --HEAD valgrind

Solution from this post.

Share Tweet

Questions?

Please start a discussion down below or send me an email!