[R-SIG-Mac] Fix for compiling C++ after upgrading to CLT for Xcode 16 on Sequoia

Jeroen Ooms jeroenoom@ @end|ng |rom gm@||@com
Mon Sep 23 22:27:40 CEST 2024


I had two different machines (both intel and arm64) that were no
longer able to compile C++ code after MacOS automatically updated to
Command Line Tools for Xcode version 16 on Sequoia. After the update,
clang is no longer able to find libc++ headers, e.g.

fatal error: 'cmath' file not found
  100 | #include <cmath>
      |          ^~~~~~~
1 error generated.

The solution is given on
https://trac.macports.org/wiki/SequoiaProblems: the installer for the
Command Line Tools for Xcode 16 does not delete a directory that was
installed by some older versions of the CLTs, which unfortunately
causes clang++ to look in the wrong place for C++ headers. The fix is
to delete the stray directory if it exists:

    sudo rm -rf /Library/Developer/CommandLineTools/usr/include/c++

Hope this helps some others.



More information about the R-SIG-Mac mailing list