Yesterday, I updated RStudio, R, and all the packages on my computer. Models that previously ran using the BRM function have now stopped working and throw a series of errors. I have tried uninstalling and reinstalling rstan and brms. The sample code and errors are below:
example(stan_model, run.dontrun = TRUE)
Error in compileCode(f, code, language = language, verbose = verbose) :
Compilation ERROR, function(s)/method(s) not created! clang: warning: no such sysroot directory: ‘/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk’ [-Wmissing-sysroot]
In file included from file5af4bbba84a.cpp:8:
In file included from /Library/Frameworks/R.framework/Versions/3.6/Resources/library/StanHeaders/include/src/stan/model/model_header.hpp:4:
In file included from /Library/Frameworks/R.framework/Versions/3.6/Resources/library/StanHeaders/include/stan/math.hpp:4:
In file included from /Library/Frameworks/R.framework/Versions/3.6/Resources/library/StanHeaders/include/stan/math/rev/mat.hpp:4:
In file included from /Library/Frameworks/R.framework/Versions/3.6/Resources/library/StanHeaders/include/stan/math/rev/core.hpp:4:
In file included from /Library/Frameworks/R.framework/Versions/3.6/Resources/library/StanHeaders/include/stan/math/rev/core/autodiffstackstorage.hpp:4:
In file included from /Library/Frameworks/R.framework/Versions/3.6/Resources/library/StanHeaders/in
Did you also update your operating system to Catalina?
Yes, thanks for checking. I just updated to Catalina, and the error remains the same:
example(stan_model, run.dontrun = TRUE)
Error in compileCode(f, code, language = language, verbose = verbose) :
Compilation ERROR, function(s)/method(s) not created! clang: warning: no such sysroot directory: ‘/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk’ [-Wmissing-sysroot]
In file included from file8fa325c5e88.cpp:8:
In file included from /Library/Frameworks/R.framework/Versions/3.6/Resources/library/StanHeaders/include/src/stan/model/model_header.hpp:4:
In file included from /Library/Frameworks/R.framework/Versions/3.6/Resources/library/StanHeaders/include/stan/math.hpp:4:
In file included from /Library/Frameworks/R.framework/Versions/3.6/Resources/library/StanHeaders/include/stan/math/rev/mat.hpp:4:
In file included from /Library/Frameworks/R.framework/Versions/3.6/Resources/library/StanHeaders/include/stan/math/rev/core.hpp:4:
In file included from /Library/Frameworks/R.framework/Versions/3.6/Resources/library/StanHeaders/include/stan/math/rev/core/autodiffstackstorage.hpp:4:
In file included from /Library/Frameworks/R.framework/Versions/3.6/Resources/library/StanHeaders/in
OK. Catalina enabled some additional security measures on January 1 that prevent the toolchain installer from working, so for the moment you need to go to
https://thecoatlessprofessor.com/programming/cpp/r-compiler-tools-for-rcpp-on-macos/
and find the section marked “Manual Install Guide”. Follow the steps from there to the end of the page and it should work.
This fixed it for me. Thanks!!