I spotted this paragraph in the CmdStan manual, version 2.28, at the bottom of page 10:
Note MacOS installations may include old version of the g++ compiler which is a
version 4.2.1. CmdStan requires g++ at 4.9.3 or later. Trying to install later versions
of g++ using homebrew or macports is no longer recommended; use the XCode
There are a few things here that trouble me slightly and might confuse newcomers. I don’t know enough about Mac Xcode’s internal workings to pull and revise it though. Maybe a more expert Stan dev Mac user could help.
First, Xcode does not include g++, only clang++ and an alias g++ which points to it. It works fine like that.
Second, the clang++ version number is more like 13.0, and what GNU g++ version that relates to I dunno.
Third, we haven’t told the newcomer how they would know that they need to run
xcode-select --install. In my experience, you type
clang++ --version and you get back something like:
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun – which is not the most helpful error message I’ve ever seen, so we should explain it. But again, I don’t know if that is a message that comes up for everyone or just my setup.
Fourth, I think we need to say more than just “use the Xcode toolchain”. But I’ve never had to update clang++ so I don’t know.
This might be an extremely hair-splitting point, but older “Mac installations” will not be MacOS but OSX. Might be best to just call it Apple Mac rather than being pulled around by their marketing dept.
Turns out there’s a lot I don’t know. The older I get, the more comfortable I am with that.
My Mac setup FYI: Monterey, Early 2015 (x86_64-apple-darwin21.2.0) MacBook pro still going strong, Xcode 13.2, Apple clang version 13.0.0 (clang-1300.0.27.3). But really, I recommend using Stan on Linux.