21

I cannot install Valgrind on macOS High Sierra. It's not available through brew. I've tried with 3.10. After make install, I get this message:

configure: error: Valgrind works on Darwin 10.x, 11.x, 12.x, 13.x and 14.x (Mac OS X 10.6/7/8/9/10)

Homebrew says:

valgrind: This formula either does not compile or function as expected on macOS
versions newer than Sierra due to an upstream incompatibility.
Error: An unsatisfied requirement failed this build.
rogerdpack
  • 62,887
  • 36
  • 269
  • 388
Alexander Kleinhans
  • 5,950
  • 10
  • 55
  • 111

9 Answers9

21

I had the problem like this. So, I found the solving. You should install valgrind by this code brew install --HEAD valgrind

qris
  • 7,900
  • 3
  • 44
  • 47
Yuriy Lesyo
  • 231
  • 1
  • 6
  • This worked for me. Thanks! Do you actually know why this works? – Bruno Silvano Oct 14 '18 at 13:26
  • I understand it the `--HEAD` flag builds the development version of the formula? – Dr_Zaszuś May 16 '19 at 10:50
  • If using this solution you then get an error after install stating the version is not compatible with your macOs you might want to check [this question](https://stackoverflow.com/questions/52732036/how-to-install-valgrind-on-macos-mojave10-14-with-homebrew) – Cedric Zoppolo Mar 25 '20 at 04:31
4

I have created a port of valgrind 3.13.0 to work on macOS High Sierra (10.13.x). You can get it here: https://github.com/padiakalpesh/valgrind_3.13_high_sierra

Once you have obtained the source, run the following commands from inside the source directory:

./configure
make
sudo make install
3

brew install Valgrind has some compatibility problem when installing on latest macOS but there is a workaround with this problem. You must be getting this error message when you try to install it using brew.

$brew install valgrind valgrind: This formula either does not compile or function as expected on macOS versions newer than High Sierra due to an upstream incompatibility. Error: An unsatisfied requirement failed this build.

-------------------------------------------------------------------SOLUTION--------------------------------------------------------------

Step1: $brew edit valgrind

Step2: Find this line in the file ->(url "https://sourceware.org/git/valgrind.git")

Step3: Replace it with -> (url "git://sourceware.org/git/valgrind.git")

Step4: $brew update

Step5: $brew install --HEAD valgrind

And Done!

Let me know if it still doesn't work. Thanks!!

2

using the brew install --HEAD valgrind also worked for me, but be sure to know that it will take awhile to pull the HEAD version, and build/install.

However, no other changes were needed.

rogerdpack
  • 62,887
  • 36
  • 269
  • 388
2

I have got this working in July 2018, for reference:

https://gist.github.com/AlessandroMinali/d8316d6cc650c97027433644c2ff31ee

Edit ./configure

- 5468: applellvm-5.1|applellvm-6.*|applellvm-7.*|applellvm-8.*)
+ 5468: applellvm-5.1|applellvm-6.*|applellvm-7.*|applellvm-8.*|applellvm-9.*)


- 5879:          16.*)
+ 5879:          17.*)

Run

./autogen.sh
./configure
make
make install

Create file ~/.valgrind.supp

# false positive for any executable (it seems)
# macOS 10.12.6
# valgrind 3.13.0
{
    libtrace initialization false positive
    Memcheck:Param
    msg->desc.port.name
    fun:mach_msg_trap
    fun:mach_msg
    fun:task_set_special_port
    fun:_os_trace_create_debug_control_port
    fun:_libtrace_init
}

Create file ~/.valgrindrc

--suppressions=$HOME/.valgrind.supp

Troubleshooting

  • if can not read suppresion file copy and paste the contents of $HOME
  • if it complains about clang versions, bump the first edit up
  • if it complains about Darwin version, bump the second edit up
Striezel
  • 3,693
  • 7
  • 23
  • 37
1

Valgrind is a rather touchy piece of software, and requires updates for each major release of macOS.

As of February 2018, there is no released version of Valgrind which supports macOS High Sierra (10.13). You will need to use a development version of Valgrind, or use alternate tools. (Apple's Instruments may have some of the functionality you are looking for.)

rogerdpack
  • 62,887
  • 36
  • 269
  • 388
1

I build the git head version of Valgrind on macOS fairly regularly. If you have xcode installed then there isn't much more to it than following the instructions here.

I'll update with my build script later.

As an alternative, you might want to consider clang sanitizers. This can be enabled in xcode, or with the -fsanitize=X option (where X is address, undefined, thread, memory and a few others).

Paul Floyd
  • 5,530
  • 5
  • 29
  • 43
1

MacPorts version started working for me in Sep 2018!

The command, for completeness sake (completes very fast - apparently, prebuilt):

sudo port install valgrind-devel

Version:

$ valgrind --version
valgrind-3.14.0.GIT
Victor Sergienko
  • 13,115
  • 3
  • 57
  • 91
0

The following worked for me using the latest Valgrind release 3.14.0 (9th October 2018) on macOS 10.13.6.

VERSION="3.14.0"
wget -O - http://www.valgrind.org/downloads/valgrind-"$VERSION".tar.bz2 | tar xjf -
cd valgrind-"$VERSION"
# use --prefix=/path/to if you want it installed somewhere in particular
./configure
make
# may need sudo
make install
# test all is working
valgrind ls -l

These instructions are taken from the README inside the Valgrind release tar ball.

Michael Hall
  • 2,834
  • 1
  • 22
  • 40