Finding libexpat on a Mac

Please fill out the following information to help in answering your question, and also see tips for posting code snippets. If you don’t provide this information it will take more time to help with your problem!

Geant4 Version: 11.4.0
Operating System: MacOS Sequia 15.6.1 (Intel)
Compiler/Version: Apple clang version 17.0.0 (clang-1700.0.13.5)
CMake Version: 3.30.2


I’ve installed geant4 on my mac, and when I try to do a build, cmake can’t find libexpat.dylib. It sets the environment variable EXPAT_LIBRARY_RELEASE to /Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk/usr/lib/libexpat.tbd, which doesn’t exist.

I’ve tried defining the environment variable to the correct location (/usr/local/cellar/expat/2.7.4/lib/libexpat.dylib) in .zshrc, but cmake always overrides it and I have to go into ccmake and change it by hand, which is kind of annoying.

I’m a real novice at cmake, so I’m sure I’m missing something, and any advice would be appreciated.

That’s odd. If you’re on Sequoia (15.6.1), that path should be …/MacOS15.sdk/… (which is a symlink). On my Mac (Tahoe 26.2), I have:
/Library/Developer/CommandLineTools/SDKs/MacOSX26.2.sdk/usr/lib/libexpat.tbd.

But my CMake sets it to something else (from CMakeCache.txt):

EXPAT_LIBRARY_RELEASE:FILEPATH=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib/libexpat.tbd

It’s going through XCode to get there, rather than /Library. That has the slight advantage that your OS version number isn’t embedded in the path.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.