Brms and stan running problems on Mac M2

Hello, I am facing an issue when runnign brms. I installed the new version of R and R studio (Version 2023.06.0+421 (2023.06.0+421)) on a Mac with M2, OS ventura 13.3.1

I’ve imported and installed some packages from the previous version of R, everything went fine.

I then update all the packages and run this line of code.

example(stan_model, package = “rstan”, run.dontrun = TRUE)

and I got this error

Error in compileCode(f, code, language = language, verbose = verbose) :
typedef double local_scalar_t__; ^56 warnings generated.error: unknown target CPU 'apple-m1’note: valid target CPU values are: i386, i486, winchip-c6, winchip2, c3, i586, pentium, pentium-mmx, pentiumpro, i686, pentium2, pentium3, pentium3m, pentium-m, c3-2, yonah, pentium4, pentium4m, prescott, nocona, core2, penryn, bonnell, atom, silvermont, slm, goldmont, goldmont-plus, tremont, nehalem, corei7, westmere, sandybridge, corei7-avx, ivybridge, core-avx-i, haswell, core-avx2, broadwell, skylake, skylake-avx512, skx, cascadelake, cooperlake, cannonlake, icelake-client, rocketlake, icelake-server, tigerlake, sapphirerapids, alderlake, knl, knm, lakemont, k6, k6-2, k6-3, athlon, athlon-tbird, athlon-xp, athlon-mp, athlon-4, k8, athlon64, athlon-fx, opteron, k8-sse3, athlon64-sse3, opteron-sse3, amdfam10, barcelona, btver1, btver2, bdver1, bdver2, bdver3, bdver4, znver1, znver2, znver3, x86-64, geodemake: *** [file1a5f3668802c.o] Error 1
Error in sink(type = “output”) : invalid connection

I have seen that it may be something related to the C complier. I have the latest verison of X code and Clang version

Target: arm64-apple-darwin22.4.0
Thread model: posix
InstalledDir: /Applications/

I remember that I had to install rosetta to be able to run some softwares. Don’t know if this is relevant.

Operating System: Mac with M2, OS ventura 13.3.1
brms Version: version 2.19.0

Solution found here

1 Like