Cmdstanr fails to install on Mac Ventura with M2 - "bad CPU" !?

Hello…I hope someone can help. I am trying to install cmdstanr for the first time on a new mac mini M2 via Rstudio. I am followed the steps outlined here:

All looks good until I run the “mod ← cmdstan_model(file)” command, when I get this error

make: bin/stanc: Bad CPU type in executable
make: *** [examples/bernoulli/bernoulli.hpp] Error 1
Warning message:
There was a problem during installation. See the error message(s) above.

Any advice on what I could try would be very much appreciated.

here is my R sessioninfo

R version 4.2.2 (2022-10-31)
Platform: aarch64-apple-darwin20 (64-bit)
Running under: macOS Ventura 13.2

Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/lib/libRlapack.dylib

[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats graphics grDevices utils datasets methods base

other attached packages:
[1] bayesplot_1.10.0 posterior_1.3.1 cmdstanr_0.5.3

loaded via a namespace (and not attached):
[1] rstudioapi_0.14 knitr_1.42 magrittr_2.0.3 tidyselect_1.2.0 munsell_0.5.0 colorspace_2.1-0 R6_2.5.1
[8] rlang_1.0.6 fansi_1.0.4 dplyr_1.1.0 tools_4.2.2 grid_4.2.2 checkmate_2.1.0 gtable_0.3.1
[15] xfun_0.37 utf8_1.2.3 cli_3.6.0 withr_2.5.0 abind_1.4-5 tibble_3.1.8 lifecycle_1.0.3
[22] processx_3.8.0 tensorA_0.36.2 farver_2.1.1 ggplot2_3.4.0 ps_1.7.2 vctrs_0.5.2 glue_1.6.2
[29] compiler_4.2.2 pillar_1.8.1 generics_0.1.3 scales_1.2.1 backports_1.4.1 distributional_0.3.1 jsonlite_1.8.4
[36] pkgconfig_2.0.3

Many thanks in advance, and apologies if I am missing something obvious.


You may need to enable/install rosetta. Can you open a terminal and run:

softwareupdate --install-rosetta

And then try again?


Many thanks for the super fast response. It worked perfectly! I seem to be able to run the example model without any issue, and will now move on to converting previous/old models implemented using a very old version of RStan on my old machine to work via Cmdstanr on this new computer.
p.s. It is really fantastic how helpful you guys are. I can only repay you in a small way by continuing to tell anyone who will listen just how great Stan is.
Best wishes, and thanks again,

1 Like