Installing Valgrind on Mac OS X Yosemite

I decided to learn a lower level like like C, in part because I want to learn about memory management, leaks, etc.

While following Zed Shaw’s tutorial I got stuck on installing Valgrind, which isn’t yet supported on Yosemite.

To get up and running, I generally followed Taras Kalapun’s tutorial, which installs Valgrind from svn. However, initially I ran into issues because aclocal and autoconf weren’t installed. Then I ran into issues because XCode wasn’t installed.

Below is how I got everything work.


After tinkering with yet another tutorial, first I installed autoconf:

curl -O
tar -xzvf autoconf-2.69.tar.gz
cd autoconf-2.69
make install

Second, I installed aclocal:

curl -O
tar -xzvf automake-1.14.1.tar.gz
cd automake-1.14.1
make install

Finally, with both installed, I could now run Taras’ tutorial:

svn co svn:// valgrind
cd valgrind
make install

Just kidding! When I ran make, I got this error:

Making all in coregrind
make[2]: *** No rule to make target `/usr/include/mach/mach_vm.defs', needed by `m_mach/mach_vmUser.c'.  Stop.
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

After some googling, it seemed the new problem was XCode.


Thanks to Jinhui Zhang’s tutorial, I realized that even though I had XCode installed in my applications, I didn’t have it installed in my command line.

So, I ran:

xcode-select --install

Then I got some coffee. xcode is a beast to install.


Once XCode was installed, I could finally finish the Valgrind install. I changed back to my valgrind directory, then ran:

make install

And with that, finally, Valgrind worked like it was supposed to. I ran Zed’s tutorial and my output matched his.