th3g3ntl3man
th3g3ntl3man

Reputation: 2106

Valgrind on macOS Sierra

I following this guide:

valgrind installation guide

After I have downloading the package, and I have run the sh script, but when I launch the make install command, it couldn't create the folder because it don't have the permission (even though I have used the sudo command).

Furthermore I tried with brew but I have this error:

valgrind: This formula either does not compile or function as expected on macOS versions newer than El Capitan due to an upstream incompatibility.

Error: An unsatisfied requirement failed this build.

Upvotes: 50

Views: 89333

Answers (5)

larboyer
larboyer

Reputation: 159

The easy alternative to valgrind on mac is called 'leaks'. It is a command-line tool, so if you don't already have xcode command-line tools installed, do so with 'xcode-select --install'.

Then, to test for leaks, just compile your prog then run 'leaks -atExit -- ./your_prog'

Upvotes: 7

rogerdpack
rogerdpack

Reputation: 66911

If you happen to be on Sierra still, this works (but not on High Sierra), just do

$ 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.
 Error: An unsatisfied requirement failed this build.

Update: seems it works on "High Sierra" OOTB now too, it now says:

...versions newer than High Sierra due to an upstream incompatibility...

Upvotes: 4

voltento
voltento

Reputation: 887

If you get an error similar to

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

you can try the workaround brew install --HEAD valgrind I found this information here https://www.gungorbudak.com/blog/2018/04/28/how-to-install-valgrind-on-macos-high-sierra/

Upvotes: 5

guru_florida
guru_florida

Reputation: 656

Latest Valgrind (git version 3.13.0) now works on MacOS Sierra but needs Xcode command line tools installed (installs needed headers).

Run this before building Valgrind:

xcode-select --install

Thanks goes to this post.

Upvotes: 14

Musen
Musen

Reputation: 1254

You can download Valgrind's latest version from their website. Then, you can just ./autogen.sh to install Valgrind. I personally did not encounter anything needed to make.

However, the sad news is, even the most recent version of Valgrind is not very usable on Mac OS Sierra. The reason is that Apple has not released the part of the source code that makes Valgrind crash, without which, the Valgrind maintainers can hardly do anything. You can read more about the discussion around the issue here .

Because Mac OS kernel is under Apple Public Source License, it has to be open-sourced someday. Thus, a Sierra-complitable version of Valgrind is only a matter of time.

Currently, I use Valgrind under Linux. This is all I can suggest now.

Upvotes: 58

Related Questions