Problem installing CmdStan on mac OS - files not found

I am trying to install CmdStan on Mac OS. I have been using it without a problem for over a year and it has worked very nicely. But now I get the following problem (see printout below) when trying to rebuild it or when trying a fresh install.

I’ve seen a bunch of links online with similar issues and I’ve tried all sorts to try to solve it, but nothing has been able to fix my problem.

I love stan and I tend to use brms with cmdstan on the backend. But, as I understand things, the problem I’m facing now is just that I cannot get CmdStan to install properly, as it is missing locations for many files. So, I’ve messed something up somehow. Unhelpfully, I cannot pinpoint what has changed in recent days on my system. But clearly somehting has changed, as it was working fine just recently.

Any help would be very much appreciated.

Rich

install_cmdstan(cores = 8, overwrite = TRUE)
The C++ toolchain required for CmdStan is setup properly!
trying URL ‘https://api.github.com/repos/stan-dev/cmdstan/releases/latest
Content type ‘application/json; charset=utf-8’ length 15934 bytes (15 KB)
==================================================
downloaded 15 KB

  • Latest CmdStan release is v2.35.0
  • Installing CmdStan v2.35.0 in /Users/rramsey/.cmdstan/cmdstan-2.35.0
  • Downloading cmdstan-2.35.0.tar.gz from GitHub…
  • Removing the existing installation of CmdStan…
    trying URL ‘https://github.com/stan-dev/cmdstan/releases/download/v2.35.0/cmdstan-2.35.0.tar.gz
    Content type ‘application/octet-stream’ length 51682840 bytes (49.3 MB)
    ==================================================

and below is just a short version of the error messages, as there were other files not found also.

In file included from …/tbb_2020.3/src/tbbmalloc/backref.cpp:17:
In file included from …/tbb_2020.3/src/tbbmalloc/tbbmalloc_internal.h:21:
In file included from …/tbb_2020.3/src/tbbmalloc/TypeDefinitions.h:54:
In file included from …/tbb_2020.3/src/tbbmalloc/Customize.h:21:
In file included from …/tbb_2020.3/include/tbb/tbb_stddef.h:91:
…/tbb_2020.3/include/tbb/tbb_config.h:36:14: fatal error: ‘cstddef’ file not found
36 | #include
| ^~~~~~~~~
1 error generated.
make[1]: *** [backend.o] Error 1
make[1]: *** Waiting for unfinished jobs…
1 error generated.
make[1]: *** [large_objects.o] Error 1
1 error generated.
make[1]: *** [backref.o] Error 1
make: *** [stan/lib/stan_math/lib/tbb/tbbmalloc.def] Error 2
1 error generated.
make: *** [stan/src/stan/model/model_header.hpp.gch/model_header_16_0.hpp.gch] Error 1
1 error generated.
1 error generated.
make: *** [bin/cmdstan/diagnose.o] Error 1
make: *** [bin/cmdstan/print.o] Error 1
1 error generated.
make: *** [bin/cmdstan/stansummary.o] Error 1
1 error generated.
make: *** [src/cmdstan/main.o] Error 1

Warning message:
There was a problem during installation. See the error message(s) above.

And my session info.

sessionInfo()
R version 4.4.1 (2024-06-14)
Platform: x86_64-apple-darwin20
Running under: macOS Sonoma 14.7

That’s strange, did you by any chance recently update your Mac operating system? We’ve seen a few cases recently where Xcode needed to be uninstalled and reinstalled after updating Mac OS. Alternatively you can just uninstall and reinstall the Xcode command line tools (the full Xcode application isn’t necessary).

1 Like

I know how frustrating this is, and I’m sorry our software’s causing you grief. This is something we just cannot seem to get on top of as Apple and Windows configs change faster than we can keep up, and every install problem someone has tends to be something novel that we can’t reproduce on our end.

I would suggest setting aside cmdstanr for a moment and focus on installing cmdstan. Once that’s installed, installing cmdstanr should be easy. Here are the direct cmdstan install instructions:

https://mc-stan.org/docs/cmdstan-guide/installation.html

P.S. Warning: Conda has just changed their terms of service for academia and non-profits, but we’re using their open-source repo, which should be OK.

1 Like

Hi Jonah,

Thanks so much. You are a total legend.

And yes, I did recently (not sure exactly when) update mac os.

But your suggestion to uninstall and re-install xcode clt worked nicely.

Thanks - I’m back in the game!

Rich

1 Like

Hi Bob,

Thanks for replying so quickly. And no need to apologise - your software is awesome and I love it. Jonah’s suggestion worked nicely, but I’ll keep your suggestions in mind for future reference. And I totally get it aboout mac and windows. Pain in the …

Thanks again

Rich

Great, glad it’s working now!