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

**URL:** <https://discourse.mc-stan.org/t/stan-files-wont-compile-since-making-changes-related-to-catalina/12417>\
**Category:** RStan\
**Created:** [December 21, 2019, 4:47am UTC](https://discourse.mc-stan.org/t/stan-files-wont-compile-since-making-changes-related-to-catalina/12417 "2019-12-21T04:47:31Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Garyappleseed](https://avatars.discourse-cdn.com/v4/letter/g/a9adbd/32.png) [@Garyappleseed](https://discourse.mc-stan.org/u/Garyappleseed)\
**Post date:** [December 21, 2019, 4:47am UTC](https://discourse.mc-stan.org/t/stan-files-wont-compile-since-making-changes-related-to-catalina/12417/1 "2019-12-21T04:47:31Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![torkar](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/torkar/32/1355_2.png) [@torkar](https://discourse.mc-stan.org/u/torkar)\
**Post date:** [December 21, 2019, 8:28am UTC](https://discourse.mc-stan.org/t/stan-files-wont-compile-since-making-changes-related-to-catalina/12417/2 "2019-12-21T08:28:03Z")

</div>

Hi

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

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

---

<div class="post-metadata">

**Author:** ![Garyappleseed](https://avatars.discourse-cdn.com/v4/letter/g/a9adbd/32.png) [@Garyappleseed](https://discourse.mc-stan.org/u/Garyappleseed)\
**Post date:** [December 21, 2019, 2:41pm UTC](https://discourse.mc-stan.org/t/stan-files-wont-compile-since-making-changes-related-to-catalina/12417/3 "2019-12-21T14:41:41Z")

</div>

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??

---

<div class="post-metadata">

**Author:** ![torkar](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/torkar/32/1355_2.png) [@torkar](https://discourse.mc-stan.org/u/torkar)\
**Post date:** [December 22, 2019, 7:53am UTC](https://discourse.mc-stan.org/t/stan-files-wont-compile-since-making-changes-related-to-catalina/12417/4 "2019-12-22T07:53:38Z")

</div>

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

> [@Dealing with Catalina II](https://discourse.mc-stan.org/t/dealing-with-catalina-ii/11802/76):
>
> @Amos, I used @coatless installation script and then changed .R/Makevars to: CFLAGS=-isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk CCFLAGS=-isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk CXXFLAGS=-isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk CPPFLAGS=-isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include SHLIB\_CXXLDFLAGS+=-Wl,-rpath,/Library/Frameworks/R.framework/Resources/lib /Library/Frameworks/R.framework/Resources…

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

```no-highlight
remove.packages("rstanarm")
install.packages("rstanarm", type = "source")

```
