109

Can you tell me how to install valgrind on yosemite? When I try to install it i get " checking for the kernel version... unsupported (14.0.0) configure: error: Valgrind works on Darwin 10.x, 11.x, 12.x and 13.x (Mac OS X 10.6/7/8/9) "

There is no official path or update, and I didn't found anything (except http://comments.gmane.org/gmane.comp.kde.devel.bugs/1553705 , but they didn't resolve that problem).

not-just-yeti
  • 17,673
  • 1
  • 18
  • 15
Nikita Kozlov
  • 1,098
  • 2
  • 8
  • 12
  • 4
    [Known issue](https://github.com/Homebrew/homebrew/issues/29988) with `homebrew` with an unsympathetic note: _" Unlikely to be fixed in the near future due to upstream's development timetable"_ – hrbrmstr Oct 25 '14 at 15:52
  • @hrbrmstr, thank you, I have solved this problem for some time by installing Ubuntu on virtual machine and then install valgrind on Ubuntu – Nikita Kozlov Nov 08 '14 at 16:33

12 Answers12

286

As there's no stable release that supports Yosemite, you can install the latest development version with

brew install --HEAD valgrind
Harry F
  • 2,976
  • 1
  • 10
  • 3
  • 5
    This command no longer works. I get this message: `Error: Failed to download resource "valgrind--patch" Download failed: https://gist.githubusercontent.com/jacknagel/cd26a902d72aabd0b51d/raw/1a61a328a87a728dccbeef0594f6fe335e9bf917/valgrind-sdk-paths-Makefile-am.diff` – André Caron Jan 01 '16 at 18:33
  • 1
    Whilst this was the correct resolution at the time of posting, Valgrind now supports OS X Yosemite through the application's documented release channels. – e76d587d9 Jun 19 '16 at 17:45
50

Whilst it may have been the case in past OS X release cycles that Valgrind took a period of time before achieving reasonable feature support, basic OS X 10.10 support is already available in Valgrind trunk due to significant work on pre-release Yosemite.

From the mailing list:

There has been some effort recently to improve Valgrind's support for Yosemite. If you develop on Mac OS, you might like to try out the trunk (svn co svn://svn.valgrind.org/valgrind/trunk) and report any breakage you get. Support for Yosemite is good enough that at least one large graphical application (Firefox) runs OK. Support for the previous release, 10.9 (Mavericks), is also substantially improved.

Note that the work has targetted 64 bit processes only. 32 bit might work, and probably better on Mavericks, but I suspect it will be increasingly problematic on Yosemite due to Valgrind's 32 bit x86 instruction set support not having progressed passed SSSE3.

Julian Seward

http://sourceforge.net/p/valgrind/mailman/message/33047840/

Full disclosure: I'm one of the new Valgrind developers who contributed patches to support OS X 10.10

e76d587d9
  • 994
  • 5
  • 14
  • 14
    +1 for contributing to valgrind. Ran it against my code. It pointed out the cause of a segmentation fault that has been driving me crazy for the past 24 hours since I couldn't find the cause. – ArtOfWarfare Feb 07 '15 at 03:20
11

Valerio's svn workflow will download every branch which is time and resource consuming. A better procedure is to download just the trunk:

svn co svn://svn.valgrind.org/valgrind/trunk valgrind
cd valgrind
./autogen.sh
./configure
make
make install
Ed Millard
  • 111
  • 2
  • Noticing that downloading this takes far longer than the release source .tar.bz did... is it just the compression that makes such a big difference or is it actually downloading files that it wouldn't otherwise? (I guess it could be the different server... or the difference between `svn co` and `curl`...) – ArtOfWarfare Feb 07 '15 at 02:36
  • +1: Worked great. Only thing I changed was I did `sudo make install` at the end instead of `make install`. Not sure if it was necessary or not as I didn't try it your way. – ArtOfWarfare Feb 07 '15 at 03:18
8

Here is my take on it. I more or less had a clean mac with xcode installed. Got it compiling and running with the following:

# build/install autoconf/automake/libtool so that 'autogen' works
curl -OL http://ftpmirror.gnu.org/autoconf/autoconf-2.69.tar.gz
tar -xzf autoconf-2.69.tar.gz 
cd autoconf-2.69
./configure && make && sudo make install
cd ..

curl -OL http://ftpmirror.gnu.org/automake/automake-1.14.tar.gz
tar -xzf automake-1.14.tar.gz
cd automake-1.14
./configure && make && sudo make install
cd..

curl -OL http://ftpmirror.gnu.org/libtool/libtool-2.4.2.tar.gz
tar -xzf libtool-2.4.2.tar.gz
cd libtool-2.4.2
./configure && make && sudo make install
cd ..

svn co svn://svn.valgrind.org/valgrind/trunk valgrind
cd valgrind
./autogen.sh
# important: configure-params, otherwise make ends in errors 
./configure -disable-tls --enable-only64bit --build=amd64-darwin 
make
# sudo, otherwise it fails due to permissions 
sudo make install  

Note that callgrind_control (from valgrind-3.11.0 SVN) doesn't appear to work on OS X, looks like a perl-script and the commandline tool which it runs (vgdb -l) prints something 'unexpected' which that script doesn't correctly parse ( so it won't be able to find the other process running with valgrind ).

Alternatively, the perl script just calls vgdb, we can also directly do that ( just figure out your process-id manually):

vgdb --pid=2858 instrumentation on
kalmiya
  • 2,988
  • 30
  • 38
  • Brilliant, this was *exactly* what I need to get valgrind running on Yosemite 10.10.4 Only thing, the command above denoting the -disable-tls switch has a unicode hyphen character, rather than the regular ascii hyphen. – Tim Kane Jul 18 '15 at 15:50
  • Happy I could help - thanks for pointing out the hyphen (updated it). Also added a work-around for the callgrind_control problem. – kalmiya Jul 21 '15 at 09:29
7

Worked for me on 10.10.1 :

svn co svn://svn.valgrind.org/valgrind
cd valgrind
./autogen.sh
./configure
make
make install
Valerio Schiavoni
  • 1,373
  • 1
  • 12
  • 19
  • Tried this. I gave up while downloading a lot of irrelevant tests. – GrantJ Aug 25 '15 at 19:30
  • 1
    The regression tests are an essential part of the Valgrind program from a developer's perspective. Whilst an official Valgrind release is yet to be made with the recent improvements to OS X platform support, unfortunately you'll need to download a version with the tests. If for any reason SVN download is troublesome on your connection, then there are *unofficial* GitHub repositories: https://github.com/liquid-mirror/valgrind – e76d587d9 Aug 27 '15 at 06:57
6

All of the solutions listed here failed for me. What finally ended up working was to use mac ports.

sudo port install valgrind-devel

bigtunacan
  • 4,873
  • 8
  • 40
  • 73
3

Here's how to install it using alternative sources besides the official svn (because it seems to be intermittently available).

https://crispyappstudiosblog.wordpress.com/2015/07/07/installing-valgrind-on-osx-yosemite/

1) Navigate to this git mirror of the svn and download the latest available version: http://repo.or.cz/w/valgrind.git

2) You need VEX as well, so grab the latest version here: http://repo.or.cz/w/vex.git

3) Extract both of them. Put the entire contents of the VEX folder into a folder called VEX in the top level of the valgrind directory.

cd to the valgrind directory, and execute the following:

Run ./autogen.sh

Run ./configure

Run make

Run sudo make install

Test it out by running valgrind --version You should be running at least 3.11.0 SVN for it work on Yosemite. Valgrind 3.11.0 SVN running on OSX Yosemite 10.10.4

user43633
  • 319
  • 3
  • 7
3

I installed it on my mac by installing homebrew and then running this 3 commands in the terminal.

  1. brew update
  2. brew doctor
  3. brew install --HEAD valgrind

PS: I have Os X El Capitan (10.11) but this should work with previous versions too.

  • Anything newer than that gives: `valgrind: This formula either does not compile or function as expected on macOS` `versions newer than El Capitan due to an upstream incompatibility.` – Alex Jun 05 '17 at 15:14
2

I finally got Valgrind to work on my OSX El Capitan 10.11.12.

User Kalmiya's answer worked for me first after I installed Xcode commandline tools.

Type this in the terminal:

xcode-select --install

Now follow Kalmiya's post, step by step. https://stackoverflow.com/a/30366798/3633475

Community
  • 1
  • 1
Raphael
  • 201
  • 2
  • 4
  • my mac book pro has latest version of mac os already updated and it is 10.11.3 not 10.11.12! also your suggestion not worked for me. this is error `Assertion 'tst->os_state.pthread - magic_delta == self' failed.` – S.M.Mousavi Mar 29 '16 at 01:19
  • @S.M.Mousavi The "Assertion 'test->os_state.pthread - magic_delta == self'" error has been fixed for Valgrind in the SVN development version. – e76d587d9 Jun 19 '16 at 17:52
  • @RhysKidd Thanks a lot for info :) – S.M.Mousavi Jun 19 '16 at 18:57
0

Here is another take on the svn install. The previous ones did not work for me, since I needed to have automake and autoconf installed, which I did not, even though I had the latest version of the Xcode command line tools installed.

I got the following from this site. I also had to link automake and autoconf after doing brew install automake and brew install autoconf by doing brew link automake and brew link autoconf for this to work.

# Check out their repo...
$ svn co svn://svn.valgrind.org/valgrind/trunk valgrind-trunk
# and hop into it.
$ cd valgrind-trunk

# You need to have autoconf and automake installed to build Valgrind
# This example uses Homebrew to install these dependencies
# (MacPorts should also work)
# (Permission error? add sudo!)
$ brew install automake
$ brew install autoconf

# run autogen.sh in valgrind-trunk
$ ./autogen.sh

# Tricky, there are some hard wired paths in the Valgrind sources.
# You need to symlink the mach folder in your XCode SDK to /usr/include/mach
# Be sure to use the proper Xcode SDK "MacOSX10.10.sdk" in the path!
$ ln -sv /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include/mach /usr/include/mach

# Run configure + set install paths in valgrind-trunk
$ ./configure --prefix=/usr/local

# Run Make and make install (permission error? add sudo!) in valgrind-trunk
$ make
$ make install

# Check it works
$ valgrind --version
valgrind-3.11.0.SVN
idmean
  • 14,540
  • 9
  • 54
  • 83
Kyle Falconer
  • 8,302
  • 6
  • 48
  • 68
  • 1
    On 10.10.3 still no success: `$ make ... 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 ` although the /usr/include/mach was created under root, symlinked as described etc. – HopeNick Apr 25 '15 at 14:50
0

I have used kalmiya's instructions to build valgrind as a conda package for OSX Yosemite. For those who work with anaconda/conda, just do

conda install -c https://conda.binstar.org/groakat valgrind

Side-note: I needed to install the command line tools as described below to get valgrind compiled.

https://stackoverflow.com/a/30471647/2156909

Community
  • 1
  • 1
P.R.
  • 3,785
  • 1
  • 27
  • 47
0

I got valgrind on Yosemite compiled, but had to use a hack to do so. While I think you should be using xcode-select install to get all command line tools (after which valgrind should make properly), but if you don't want to do this (eg. size of Xcode tools too big), you can also get the Darwin OSX code and copy the following files to /usr/include/mach

   mach_vm.defs
    task.defs
    thread_act.defs
    vm_map.defs

This allowed a clean compile and install, although note it is a rather slack hack.

Pete855217
  • 1,570
  • 5
  • 23
  • 35