Friendly Mac C++ installer does not work for me ... what's another option

I have a new computer running Mac (OS Monterey) and am trying to set up Rstan. Following the friendly guide here: Configuring C Toolchain for Mac · stan-dev/rstan Wiki · GitHub

Leads me here: GitHub - rmacoslib/r-macos-rtools: Scripts to build an **unofficial** Rtools-esq installer for the macOS R toolchain

Which leads me to this issue lots of others seem to have:

Is there a backup (old school fine) way I could do this?


Apologies in advance if this is answered elsewhere. I imagine it must be, I just cannot find it in my nothing-on-this-new-Mac-seems-easy haze.

For those interested, the answer to this problem was to give up on Rstan and use CmdStanR. Thanks to @jonah I followed:

and then follow the instructions in

This worked generally without any real hitches (a number of packages did not install on the first pass, and I had to set the path but otherwise this took 1/20th of the time I spent just to get stuck on my Makevars file).

Hi @lizzieinvancouver thanks for sharing. I’m wondering whether you followed only the instructions in MacOS: clang++ and make or whether any of the other instructions in 1 CmdStan Installation applied?

I’m only following these instructions so that I can eventually install brms, which requires installation of Rstan, so I’m really hoping this works.

I spent a sad amount of time yesterday (to arrive here: apple m1 - M1 Silicon gfortran c++ in R install issues - Stack Overflow) to not get Rstan running, so for today all I did was the following in Terminal:

clang++ --version
make --version

Then in R I followed the installing guide here (and checked the test model): Getting started with CmdStanR • cmdstanr

If you have Monterey and get Rstan running, please do tell! I miss Rstan because it fit more with my love of base R (Meghan Trainor - All About That Bass (huts skit 2017 parody) - YouTube).

1 Like

A few additional things:

  • According to @bgoodri the error that happens with the Mac toolchain is a false positive. That is, there’s a message that says it failed but in many cases you can proceed as if it succeeded and rstan will work. I haven’t been able to verify this myself because I don’t have the right setup on my computer yet.

  • @mcraft it’s now possible to use brms with cmdstanr as the backend instead of rstan (I think rstan will still be installed but brms won’t require that you can successfully compile models with rstan if you use backend="cmdstanr").

  • @lizzieinvancouver one thing you can do is convert a model fit using cmdstanr to a stanfit object from rstan. That way you can use the post-processing stuff from rstan if you prefer it. There’s an example at Getting started with CmdStanR • cmdstanr. This requires the rstan package be installed but does not require that you can successfully compile models with rstan.


Quick update (@mcraft):
Based on @jonah recommendations I just went back and followed the instructions here again. The installer failed again, but as @bgoodri suggested it may be a false positive as my test model compiled in the end. Happy chains.

1 Like