I tried to install Valgrind with brew install Valgrind
and got :
valgrind: This formula either does not compile or function as expected
on macOS
Not a proper solution for macOs, but for the time being, I created a docker image. After installing docker for macOS, this is how to start valgrind:
cd
curl -O https://raw.githubusercontent.com/biocyberman/ValgrindDocker/master/startValgrind
./startValgrind # this will takes time for the first time, because it needs to fetch docker valgrind image
# you will get a root command prompt inside the docker image.
# do what ever you want
# type 'exit' to quit