Won't start on Mac OS 26.1 (Library not loaded)
Context
Crashes right after install:
→ valgrind
dyld[53164]: Library not loaded: @rpath/libmydyld.so
Referenced from: <C0ACADCA-2E83-3D1F-8ED1-CDDEAB161CD4> /opt/homebrew/Cellar/valgrind/HEAD-926705e/libexec/valgrind/memcheck-arm64-darwin
Reason: tried: '/opt/homebrew/Cellar/valgrind/HEAD-926705e/libexec/valgrind/libmydyld.so' (missing LC_LOAD_DYLIB (must link with at least libSystem.dylib)), '/opt/homebrew/Cellar/valgrind/HEAD-926705e/libexec/coregrind/libmydyld.so' (no such file), '/opt/homebrew/Cellar/valgrind/HEAD-926705e/libexec/valgrind/libmydyld.so' (missing LC_LOAD_DYLIB (must link with at least libSystem.dylib)), '/opt/homebrew/Cellar/valgrind/HEAD-926705e/libexec/coregrind/libmydyld.so' (no such file), '/usr/local/lib/libmydyld.so' (no such file), '/usr/lib/libmydyld.so' (no such file, not in dyld cache)
fish: Job 1, 'valgrind' terminated by signal SIGABRT (Abort)
I checked and the files indeed don't exist
Information
- macOS architecture (
uname -m): arm64 - macOS version (
sw_vers): - ProductName: macOS
- ProductVersion: 26.1
- BuildVersion: 25B78
- Xcode version (
xcrun --sdk macosx --show-sdk-version): 26.1
Hi @nym21,
Thank you for your report. I think this should be fairly straightforward to fix, unfortunately I do not have access to a macOS 26 computer at the moment (and the GitHub runner seems happy with it).
So this might need to wait a bit longer for me to have a dev machine.
No worries, good luck !
I finally have macOS 26 to test with but unfortunately I don't have a (great) solution yet.
I can reproduce the same issue by installing through brew but not locally. When looking at the installed files, I could see that libmydyld.so and libmySystem.so don't seem to be built correctly.
They have the wrong id name, which you can check with otool -D, /opt/homebrew/opt/valgrind/libexec/valgrind/libSystem.B.dylib instead of /usr/lib/libSystem.B.dylib and /opt/homebrew/opt/valgrind/libexec/valgrind/libdyld.dylib instead of /usr/lib/system/libdyld.dylib.
Changing them manually to the correct value doesn't solve the issue, the Valgrind tool just crashes when dyld initializes the binary.
So until I understand why this is happening, if brew changed something on macOS 26, etc, you can build from source instead. Just clone this repo and run ./autogen.sh && ./configure --prefix=where_you_want_to_install && make -j 16 && sudo make install. It's a bit annoying but at least you can use Valgrind for now.
Thanks for trying !
I do that but It says zsh: command not found: valgrind when I try to use cachegrind.
@Nikky112 What file path did you add in configure --prefix=path? Is that in your $PATH variable?
If you chose something like configure --prefix=/Users/abc/valgrind you would then need to add /Users/abc/valgrind/bin in your PATH, e.g. export PATH=$PATH:/Users/abc/valgrind/bin.
I used the same path where Homebrew had already installed it, do I need to change the PATH to add it as well?
Depends. Where did you install it?
Homebrew will usually install it in something like /opt/homebrew/Cellar/valgrind/HEAD-b1d25c5/ with the binary being at /opt/homebrew/Cellar/valgrind/HEAD-b1d25c5/bin/valgrind. After that brew will link the command in /opt/homebrew/bin, which is usually the path in your PATH.
If you did the above but didn't link it then your shell won't find it. I would suggest you find where it is installed (find /usr /opt -name valgrind) and make sure to include the path in your PATH variable. Or install it in a standard directory which is already in your PATH (but maybe avoid messing with the brew files).
Ok, now it works, tysm!
It builds successfully it seems but sadly when I try to run it I get:
→ ./valgrind
valgrind: Unknown/uninstalled VG_PLATFORM 'arm64-darwin'
You can't use valgrind this way. Either you need to install it fully on your system or you need to use the vg-in-place script.
Check this document for reference: https://github.com/LouisBrunner/valgrind-macos/blob/main/README_DEVELOPERS#L10-L25
Missed that, thank you