Today : Fri, 03 Jul 20 .

CS537 Student Wiki





Project Discussion

edit SideBar


Page: PmWiki.GeneralDiscussionAndAdvice - Last Modified : Wed, 30 Sep 09

This is an opportunity to pass along hints or tips, or ask questions about operating systems and C programming in general.

Notes on how to edit this are available in Editing

Compiling Valgrind for OS X 10.6 Snow Leopard

If you use a Linux port utility like Fink or MacPorts you will find that valgrind does not compile on OS X 10.6. Here are the steps I took to patch, compile, and use valgrind on 10.6.

Before running through these steps, make sure you have installed xCode in order to install gcc.

  1. Download the 10.6 patch (snowleopard.patch) from here: (The easiest method is to just use File > Save Page As while viewing that page in Firefox).
  2. Open and run this command svn co svn:// valgrind. This will checkout the 3.5.0 version of valgrind's source code to the directory valgrind in your current directory. So, if you ran this while on your ~/Desktop directory, you could find valgrind on your desktop.
  3. Move snowleopard.patch into the new valgrind directory and run this command while in that directory: patch -p0 < snowleopard.patch
  4. After the patch is finished (patch will list files that were patched) you need to run this command: ./
  5. ./ will make a script called configure which is used to automatically build a Makefile. If you want to install valgrind into a special directory (which will make it easier to delete later on) you can run ./configure --prefix=/the/location/of/your/directory. You should also make sure that that directory is in your shell's $PATH. Otherwise, you can just run ./configure
  6. Next, you will need to compile valgrind and install it. Just run this command to do so: make ; make install
  7. You should now have a working version of valgrind. Type valgrind --help to test or which valgrind. If those command fail, make sure whatever directory you installed valgrind in is in your shell's $PATH (echo $PATH to view it).

Known Issues

If you run uname -m in, you will notice that 10.6 reports that it is an i386 kernel and not x86_64. Because of this, valgrind compiles under 32-bit mode and can't be used on 64-bit binaries. This is a known issue when compiling many Linux apps under 10.6. To fix this, you can compile your code as 32-bit. To do this run gcc -m32 your_code.c. The binary produced will be 32-bit and valgrind is fine with it. The other option is to hack the configure script to force valgrind to compile under 64-bit (which I am going to try and do sometime soon). If anyone else knows another work around, please let me know.

- Neil Goodman <>

This page may have a more recent version on PmWiki:GeneralDiscussionAndAdvice, and a talk page: PmWiki:GeneralDiscussionAndAdvice-Talk.

Powered by PmWiki
Skin by CarlosAB

looks borrowed from
More skins here

PmWiki can't process your request

Cannot acquire lockfile

We are sorry for any inconvenience.

More information

Return to