Problem Installing CmdStan on macOS - Bad CPU type in executable

I cannot install cmdstan on my MacBook Pro (M4Max).
I was able to install it without any issues on other Macs with M2Ultra and M2Max.
What could be the reason for the installation failure?
What should I improve to successfully install it?

I would appreciate your guidance.

OS: macOS 15.2

pckg <- "cmdstanr"
if(!require(pckg, character.only = TRUE)){
  install.packages("cmdstanr", repos = c("https://mc-stan.org/r-packages/", getOption("repos")))
  if (!require(pckg, character.only = TRUE)){
    str = paste0("could not install ", pckg)
    stop(str)
  }
}

install_cmdstan(overwrite = TRUE)

--- Translating Stan model to C++ code ---
bin/stanc  --o=examples/bernoulli/bernoulli.hpp examples/bernoulli/

I’d guess that you don’t have Rosetta enabled/installed.

To install, can you open up a terminal and run:

softwareupdate --install-rosetta

Then try your cmdstan model again?

Thank you for the appropriate advice.
After installing Rosetta, CmdStan was installed without any problems.
Because “arch=arm64” was set in the makefile when building CmdStan, I mistakenly thought that Rosetta was unnecessary.
So, it means that “bin/stanc itself, which compiles Stan files, is not Apple Silicon native.”

Is the version of R / Rstudio you are running apple silicon native ?

stanc just translates the Stan language to c++ which is then compiled by the native toolchain, so there’s little impact by running through Rosetta.

Although the next release will include a universal binary for stanc on macos, so Rosetta won’t be necessary soon

1 Like

R is native, and RStudio is universal.
Thank you

I’m excited about the next version.