# Trouble with initial use of rstan

**URL:** <https://discourse.mc-stan.org/t/trouble-with-initial-use-of-rstan/11858>\
**Category:** Interfaces\
**Tags:** rstan\
**Created:** [November 11, 2019, 7:24pm UTC](https://discourse.mc-stan.org/t/trouble-with-initial-use-of-rstan/11858 "2019-11-11T19:24:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![brbaer](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/brbaer/32/10529_2.png) [@brbaer](https://discourse.mc-stan.org/u/brbaer)\
**Post date:** [November 11, 2019, 7:24pm UTC](https://discourse.mc-stan.org/t/trouble-with-initial-use-of-rstan/11858/1 "2019-11-11T19:24:11Z")

</div>

Operating System: macOS Catalina, Version 10.15.1 (19B88)  
Interface Version: rstan\_2.19.2 (found via ‘sessionInfo()’)  
Compiler/Toolkit: Using R Version “x86\_64-apple-darwin15.6.0” (3.6.1)

After following the instructions in the [RStan Getting Started](https://github.com/stan-dev/rstan/wiki/RStan-Getting-Started) guide, I get the following error message

> Error in compileCode(f, code, language = language, verbose = verbose) :  
> Compilation ERROR, function(s)/method(s) not created! /bin/sh: /usr/local/clang7/bin/clang++: No such file or directory  
> make: \*\*\* [fileba113a08d682.o] Error 127  
> In addition: Warning message:  
> In system(cmd, intern = !verbose) :  
> running command ‘/Library/Frameworks/R.framework/Resources/bin/R CMD SHLIB fileba113a08d682.cpp 2\> fileba113a08d682.cpp.err.txt’ had status 1  
> Error in sink(type = “output”) : invalid connection

after running

> schools\_dat ← list(J = 8, y = c(28, 8, -3, 7, -1, 1, 18, 12), sigma = c(15, 10, 16, 11, 9, 11, 10, 18))  
> fit ← stan(file = ‘8schools.stan’, data = schools\_dat)

where ‘8schools.stan’ is saved in my working directory. In case it’s helpful to know, running

> pkgbuild::has\_build\_tools(debug = TRUE)

returns “TRUE”.

Does anyone have guidance they could share on how I should fix this problem?

---

<div class="post-metadata">

**Author:** ![stevebronder](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/stevebronder/32/17242_2.png) [@stevebronder](https://discourse.mc-stan.org/u/stevebronder)\
**Post date:** [November 11, 2019, 7:32pm UTC](https://discourse.mc-stan.org/t/trouble-with-initial-use-of-rstan/11858/2 "2019-11-11T19:32:36Z")

</div>

See below for issues with catalina

> [@Dealing with Catalina II](https://discourse.mc-stan.org/t/dealing-with-catalina-ii/11802):
>
> If you have Catalina and clang++ installed from @coatless’s installer and rstan is not working, try the newest installer from

---

<div class="post-metadata">

**Author:** ![brbaer](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/brbaer/32/10529_2.png) [@brbaer](https://discourse.mc-stan.org/u/brbaer)\
**Post date:** [November 11, 2019, 9:14pm UTC](https://discourse.mc-stan.org/t/trouble-with-initial-use-of-rstan/11858/3 "2019-11-11T21:14:51Z")

</div>

Thanks for sharing this! My problem was resolved by using the clang++ installer and running the provided code.
