38

I tried to install Valgrind with the command "brew install valgrind" and I get a message that says:

"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."

I also tried to "brew edit valgrind" and replace "sourceware.org/git/valgrind.git" with "git://sourceware.org/git/valgrind.git" in head section of the code, then wrote on Iterm "brew install --HEAD valgrind" but it gives me:

Last 15 lines from /Users/m/Library/Logs/Homebrew/valgrind/02.configure:
checking for gcc-ar... no
checking for perl... /usr/bin/perl
checking for gdb... /no/gdb/was/found/at/configure/time
checking dependency style of clang... none
checking for diff -u... yes
checking for clang option to accept ISO C99... none needed
checking for a supported version of gcc... ok (clang-11.0.0)
checking build system type... x86_64-pc-darwin
checking host system type... x86_64-pc-darwin
checking for a supported CPU... ok (x86_64)
checking for a 64-bit only build... yes
checking for a 32-bit only build... no
checking for a supported OS... ok (darwin)
checking for the kernel version... unsupported (19.0.0)
configure: error: Valgrind works on Darwin 10.x, 11.x, 12.x, 13.x, 14.x, 15.x, 16.x and 17.x (Mac OS X 10.6/7/8/9/10/11 and macOS 10.12/13)

READ THIS: https://docs.brew.sh/Troubleshooting
My Tran Bui
  • 503
  • 1
  • 4
  • 7

2 Answers2

47

See https://github.com/LouisBrunner/valgrind-macos/.

Either try

brew tap LouisBrunner/valgrind
brew install --HEAD LouisBrunner/valgrind/valgrind

Or compile it from the source, if the above method doesn't work. (But they should have fixed the above method just recently.)

git clone https://github.com/LouisBrunner/valgrind-macos.git
cd valgrind-macos
./autogen.sh
./configure --prefix=/where/you/want/it/installed --enable-only64bit
make 
sudo make install

Enjoy!

Xie Yanbo
  • 430
  • 6
  • 16
linfeng chen
  • 522
  • 6
  • 5
  • 2
    Today's version from github seems to have some improvements. I built it from the directions here, with a few changes: 1. No need for step 5. 2. No need for sudo at steps 3, 4, and 6. So far, it seems to be working fine on Catalina 10.15.4. – Bob Murphy Apr 27 '20 at 23:35
  • this version returns leak on every single program: `==54507== definitely lost: 11,928 bytes in 127 blocks` – TomSawyer Jun 16 '20 at 11:14
  • 1
    does not work now got ```libmpiwrap.c:736:39: error: expected expression if (ty == MPI_LB || ty == MPI_UB)``` – KWC Jul 16 '20 at 13:34
  • Thanks for putting some work into this. Much appreciated. – David Vernon Jul 17 '20 at 17:57
  • Thanks for what you've done! My version is 10.15.6, and it works all right till now. – LimingFang Sep 10 '20 at 15:34
  • 1
    Catalina 10.15.6, This version always reports memory leaks. – The Matt Sep 11 '20 at 13:46
  • Is there a way to install this with Macports instead? – bhaller Sep 23 '20 at 13:00
  • On version 10.15.7 I am getting `m_syswrap/syswrap-darwin.c:3242:9: error: use of undeclared identifier 'ATTR_CMNEXT_CLONEID'` during compilation. I haven't figure out what to do yet – PKua Apr 15 '21 at 12:49
  • 2
    It doesn't work on macOS 12.3. It says `configure: error: Valgrind works on Darwin 10.x-20.x (Mac OS X 10.6-10.11 and macOS 10.12-11.0)` – Aaron Franke Apr 19 '22 at 05:59
1

https://github.com/sowson/valgrind

brew install --HEAD https://raw.githubusercontent.com/sowson/valgrind/master/valgrind.rb

MacOS Catalina (10.15.4), I was able to confirm the operation.

סטנלי גרונן
  • 2,917
  • 23
  • 46
  • 68