Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install Valgrind on macOS Catalina (10.15) with Homebrew?

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 
like image 283
Mochi Avatar asked Oct 13 '19 02:10

Mochi


People also ask

Does valgrind work on macOS?

x and later), ARM64/Android, X86/Android (4.0 and later), MIPS32/Android, X86/FreeBSD, AMD64/FreeBSD, X86/Darwin and AMD64/Darwin (Mac OS X 10.12). Valgrind is Open Source / Free Software, and is freely available under the GNU General Public License, version 2.

Can you download Valgrind on Mac?

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.


1 Answers

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!

like image 84
linfeng chen Avatar answered Sep 22 '22 07:09

linfeng chen