# Error in compileCode while installing (Mac)

**URL:** <https://discourse.mc-stan.org/t/error-in-compilecode-while-installing-mac/4066>\
**Category:** RStan\
**Created:** [May 2, 2018, 8:48am UTC](https://discourse.mc-stan.org/t/error-in-compilecode-while-installing-mac/4066 "2018-05-02T08:48:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![speoples](https://avatars.discourse-cdn.com/v4/letter/s/f1d935/32.png) [@speoples](https://discourse.mc-stan.org/u/speoples)\
**Post date:** [May 2, 2018, 8:48am UTC](https://discourse.mc-stan.org/t/error-in-compilecode-while-installing-mac/4066/1 "2018-05-02T08:48:35Z")

</div>

Hi there,

I’m very new to rstan. I’m trying to download it onto my computer and it continuously comes up with an error and I’m not sure how to fix it. I’ve tried to download Rstan in Rstudio and R, with the same result. I’ve followed the instructions on the github diligently, so I’m not sure what went wrong. I downloaded xcode from the app store, as rstan requires and opened it before moving on with rstan installation.

- Here is the error I get after installing Rstan and trying out the bit of code on the github website:\*\*

* * *

Here are other specs that might be useful:

- Operating System : macOS High Sierra, Version 10.13.4

- RStan Version : 2.17.3

- Output of `writeLines(readLines(file.path(Sys.getenv("HOME"), ".R/Makevars")))` :

CXXFLAGS=-O3 -mtune=native -march=native -Wno-unused-variable -Wno-unused-function -Wno-macro-redefined

CC=clang  
CXX=clang++ -arch x86\_64 -ftemplate-depth-256

- Output of `devtools::session_info("rstan")` :

Session info ----------------------------------------------------------  
setting value  
version R version 3.4.4 (2018-03-15)  
system x86\_64, darwin15.6.0  
ui RStudio (1.0.143)  
language (EN)  
collate en\_US.UTF-8  
tz Europe/Berlin

Packages --------------------------------------------------------------  
package \* version date source  
assertthat 0.2.0 2017-04-11 CRAN (R 3.4.0)  
BH 1.66.0-1 2018-02-13 CRAN (R 3.4.3)  
cli 1.0.0 2017-11-05 CRAN (R 3.4.2)  
colorspace 1.3-2 2016-12-14 CRAN (R 3.4.0)  
crayon 1.3.4 2017-09-16 CRAN (R 3.4.1)  
dichromat 2.0-0 2013-01-24 CRAN (R 3.4.0)  
digest 0.6.15 2018-01-28 CRAN (R 3.4.3)  
ggplot2 \* 2.2.1 2016-12-30 CRAN (R 3.4.0)  
glue 1.2.0 2017-10-29 CRAN (R 3.4.2)  
graphics \* 3.4.4 2018-03-15 local  
grDevices \* 3.4.4 2018-03-15 local  
grid 3.4.4 2018-03-15 local  
gridExtra 2.3 2017-09-09 CRAN (R 3.4.1)  
gtable 0.2.0 2016-02-26 CRAN (R 3.4.0)  
inline 0.3.14 2015-04-13 CRAN (R 3.4.0)  
labeling 0.3 2014-08-23 CRAN (R 3.4.0)  
lattice 0.20-35 2017-03-25 CRAN (R 3.4.4)  
lazyeval 0.2.1 2017-10-29 CRAN (R 3.4.2)  
magrittr 1.5 2014-11-22 CRAN (R 3.4.0)  
MASS 7.3-49 2018-02-23 CRAN (R 3.4.4)  
Matrix 1.2-14 2018-04-09 CRAN (R 3.4.4)  
methods \* 3.4.4 2018-03-15 local  
munsell 0.4.3 2016-02-13 CRAN (R 3.4.0)  
pillar 1.2.2 2018-04-26 CRAN (R 3.4.4)  
plyr 1.8.4 2016-06-08 CRAN (R 3.4.0)  
R6 2.2.2 2017-06-17 CRAN (R 3.4.0)  
RColorBrewer 1.1-2 2014-12-07 CRAN (R 3.4.0)  
Rcpp 0.12.16 2018-03-13 CRAN (R 3.4.4)  
RcppEigen 0.3.3.4.0 2018-02-07 CRAN (R 3.4.3)  
reshape2 1.4.3 2017-12-11 CRAN (R 3.4.3)  
rlang 0.2.0 2018-02-20 CRAN (R 3.4.3)  
rstan \* 2.17.3 2018-01-20 CRAN (R 3.4.3)  
scales 0.5.0 2017-08-24 CRAN (R 3.4.1)  
StanHeaders \* 2.17.2 2018-01-20 CRAN (R 3.4.3)  
stats \* 3.4.4 2018-03-15 local  
stats4 3.4.4 2018-03-15 local  
stringi 1.1.7 2018-03-12 CRAN (R 3.4.4)  
stringr 1.3.0 2018-02-19 CRAN (R 3.4.3)  
tibble 1.4.2 2018-01-22 CRAN (R 3.4.3)  
tools 3.4.4 2018-03-15 local  
utf8 1.1.3 2018-01-03 CRAN (R 3.4.3)  
utils \* 3.4.4 2018-03-15 local  
viridisLite 0.3.0 2018-02-01 CRAN (R 3.4.3)

---

<div class="post-metadata">

**Author:** ![roualdes](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/roualdes/32/1594_2.png) [@roualdes](https://discourse.mc-stan.org/u/roualdes)\
**Post date:** [May 2, 2018, 2:56pm UTC](https://discourse.mc-stan.org/t/error-in-compilecode-while-installing-mac/4066/2 "2018-05-02T14:56:01Z")

</div>

I googled parts of your error message

> [@speoples](#):
>
> xcrun: error: invalid active developer path

and found the suggestion to try running the following code in a terminal window (found /Applications/Utilities/Terminal.app):

`xcode-select --install`

Also, the following thread might have some more options for you if the above still doesn’t cut it:

> [@Suggestions for OS X install wiki](http://discourse.mc-stan.org/t/suggestions-for-os-x-install-wiki/3425):
>
> The wiki currently suggests installing the command line tools by installing Xcode, a 5GB download & 9GB install size. I suggest it instead suggest simply running xcode-select --install in a terminal, which installs simply the command line tools alone. Further, I think some of the packages on which RStan depends require things like openssl, curl, etc, in which case I think we should be recommending folks use the mature/popular [homebrew](https://brew.sh/) package management system. Indeed, a simple shell script to…

---

<div class="post-metadata">

**Author:** ![speoples](https://avatars.discourse-cdn.com/v4/letter/s/f1d935/32.png) [@speoples](https://discourse.mc-stan.org/u/speoples)\
**Post date:** [May 2, 2018, 3:06pm UTC](https://discourse.mc-stan.org/t/error-in-compilecode-while-installing-mac/4066/3 "2018-05-02T15:06:49Z")

</div>

That seems to have solved the problem. Thank you very much!
