installing the brms package and C++ compiler

dear Posit Community,

i have a task that i must complete for a course, but the instructions are based for the application version of R-studio, which i do not have.

we have a lecture on the Bayesian approach, so need to install the brms package. it's a package that depends on a C++ compiler (stan), which needs to be installed first and linked to R.

for reference, i use Mac OS Catalina (10.15.4)

does anyone know how i can achieve this? any help is appreciated greatly !!!

1 Like

I am fairly sure that the RStudio version does not matter.

How you install a C++ compiler depends on your OS. On Windows, install Rtools, on macOS, install the the XCode command line tools. On Linux, install the g++ (or similar) package.

1 Like

On top of this, look into the sysreqs and pre-requisites for the rstan package which provides the interface between R and stan:


From RStan: the R interface to Stan (r-project.org):

"Stan has a modeling language, which is similar to but not identical to that of the Bayesian graphical modeling package BUGS (Lunn et al. 2000). A parser translates a model expressed in the Stan language to C++ code, whereupon it is compiled to an executable program and loaded as a Dynamic Shared Object (DSO) in R which can then be called by the user.

A C++ compiler, such as g++ or clang++, is required for this process. For instructions on installing a C++ compiler for use with RStan see RStan-Getting-Started.

The rstan package also depends heavily on several other R packages:

  • StanHeaders (Stan C++ headers)
  • BH (Boost C++ headers)
  • RcppEigen (Eigen C++ headers)
  • Rcpp (facilitates using C++ from R)
  • inline (compiles C++ for use with R)

These dependencies should be automatically installed if you install the rstan package via one of the conventional mechanisms.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.