Error in CompileCode after reinstall for brms and rstan

I’m trying to Knit a PDF from an Rmd file for a test case for my university’s IT department to make sure we have stan and all the relevant dependencies install to enable students to run Bayesian modelling next semester (long lead in time). But I keep running into an issue with a code chunk that uses brms. I’ve updated/reinstalled everything including toolchains etc. but keep getting this error (or a version thereof):

Error in compileCode(f, code, language = language, verbose = verbose) : In file included from :1:In file included from /Library/Frameworks/R.framework/Versions/4.1/Resources/library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp:13:In file included from /Library/Frameworks/R.framework/Versions/4.1/Resources/library/RcppEigen/include/Eigen/Dense:1:/Library/Frameworks/R.framework/Versions/4.1/Resources/library/RcppEigen/include/Eigen/Core:82:12: fatal error: ‘new’ file not found 82 | #include | ^~~~~1 error generated.make: *** [fileae3572bb1588.o] Error 1

Code chunk:

case1.m1b = brm(Carbon~1+GraveSize,data=case1) 

marginal_effects(case1.m1b,spaghetti = TRUE,nsamples=100) 

session14Mphil.RData (2.7 KB)

Operating System: macOS Sonoma 14.5
Interface Version: R version 4.1.3, brms 2.16.3, rstan 2.21.3
Compiler/Toolkit: macrtools 0.0.5

1 Like