Stan files won't compile since making changes related to Catalina

I am having problems using rstan with Catalina. I made a number of changes, including .R\Makevars file suggested by a post called Dealing with Catalina II. Now nothing will compile and I can’t get back to the original. I am in Catalina 10.15.2, R 3.6.2 and Stan 2.19.2. I reinstalled Rstudio, R, and rstan but no changes. I’ve been trying different suggestions for .R/Makevars in the Dealing with Catalina II post, but no luck. The errors are:

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 file2d74f83c872.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

Hi

do you have this? /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk

What happens when you type this in a terminal:
xcode-select --install

I did not have it, and that line installed it. That solved this problem. Thank you!

Actually I made the changes to the installer and Makevars before Catalina updated itself to a new version, which might have changed some things.
By now I’ve changed Makevars so much I’m not sure what it should be. Does it make a difference? Anything you can point me to??

1 Like

Gary, YMMV but this works great for me using Catalina, R 3.6.2, and the installer by @coatless:

If you stumble into problems make sure to recompile, e.g., rstanarm and other packages from source:

remove.packages("rstanarm")
install.packages("rstanarm", type = "source")
1 Like