While I do make in a program I want to install, which installs fine in Opensuse, I get the error

warning: include path for stdlibc++ headers not found; pass '-stdlib=libc++' on the command line to use the libc++
      standard library instead [-Wstdlibcxx-not-found]
/Users/xyz/rivet/YODA-1.7.7/pyext/yoda/util.cpp:446:10: fatal error: 'utility' file not found
#include <utility>
1 warning and 1 error generated.
error: command 'g++' failed with exit status 1
make[2]: *** [all-local] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all-recursive] Error 1

What I understand that it complains about not finding the utility library in c++ but for MacOS, the compiler is clang and it shows it has the file


MacOS version is 10.14.6, and Xcode version is Version 11.0 (11A420a). How to solve this case then?

  • clang is not g++ e.g. it has different parameters. and OpenSuse is Linux not MacOS - You need to configure the build system to use the correct compiler and OS specific things, then it might work. Not every thing wrtitten for Linux works on macOS – mmmmmm Sep 25 '19 at 20:50
  • I know OpenSuse is Linux, the point here to mention that the script works actually, and the exact script has worked on other Macs of my colleagues. – tachyon Sep 25 '19 at 21:38
  • Then you need to include more info in the question the obvious thing is how does your setup differ from your colleague? – mmmmmm Sep 25 '19 at 21:43
  • 1
    That is what I don't know. The .profile file seems not to exist in my machine but there is a .bashrc. I am looking for any specific command in the .profile/.bashrc which can solve this issue. – tachyon Sep 26 '19 at 7:47
  • 1
    nB the command is g++ --print-search-dirs note the last s – mmmmmm Sep 26 '19 at 17:44

The solution is in the warning message: pass '-stdlib=libc++' in the command line when you run the install command. So just add CXX="g++ -stdlib=libc++" to the install/make command.


The solution is pretty simple, yet hard to find: You need to set the environment variable MACOSX_DEPLOYMENT_TARGET to 10.14 for Mojave and likely 10.15 for Catalina, like so


Thanks to @ChristophSchmidl who gave this hint at:


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .