I'm having troubles installing Valgrind on the macOS Big Sur through the Homebrew. In the terminal I have tried
$ brew install valgrind
After Homebrew's autoupdate, I got the following message:
valgrind: Linux is required for this software.
Error: An unsatisfied requirement failed this build.
Is there a way I can install Valgrind?
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.
Valgrind does not seem to work on M1 Macs.
Apple only officially supports the three most recent versions of macOS (currently 10.15 Catalina, 11 Big Sur, and 12 Monterey). If you're running an older version of macOS, it is no longer receiving security or stability updates.
Roughly your only hope is here, a work in progress.
brew tap LouisBrunner/valgrind
brew install --HEAD LouisBrunner/valgrind/valgrind
I’d say Valgrind is a lost cause on macOS. Try looking into Address/Leak Sanitizer. Note that Apple Clang does not support leak checking, so you’ll have to grab llvm off Brew instead. If you use -fsanitize=address
, you’ll also have to prepend ASAN_OPTIONS=detect_leaks=1
on macOS.
Valgrind is not supported by Big Sur, but you can try this
brew tap LouisBrunner/valgrind
brew install --HEAD LouisBrunner/valgrind/valgrind
or a better option in Preferences | Build, Execution, Deployment | CMake -> Cmake options use
-DCMAKE_BUILD_TYPE=ASAN -DCMAKE_CXX_COMPILER=/usr/local/opt/llvm/bin/clang++
and
You can try leaks. I don't know how it compares to valgrind in terms of features, but it's enough for me rn.
leaks -atExit -- ./path/to/binary
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With