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 package management system.
Indeed, a simple shell script to install everything from scratch would be:
#!/bin/sh #install homebrew (automatically installs command-line tools) /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" #install R brew cask install r-app #alternative for longer install but possibly-faster-r performance: #brew install openblas #brew install r --with-openblas #install RStudio brew cask install rstudio #install rstan echo ' dotR <- file.path(Sys.getenv("HOME"), ".R") if (!file.exists(dotR)) dir.create(dotR) M <- file.path(dotR, "Makevars") if (!file.exists(M)) file.create(M) cat( "\nCXXFLAGS=-O3 -mtune=native -march=native -Wno-unused-variable -Wno-unused-function -Wno-macro-redefined", "\nCC=clang", "CXX=clang++ -arch x86_64 -ftemplate-depth-256", file = M, sep = "\n", append = TRUE) Sys.setenv(MAKEFLAGS = paste0("-j",parallel::detectCores()/2)) install.packages("rstan", repos = "https://cloud.r-project.org/", dependencies=TRUE) ' > /tmp/temp.r Rscript /tmp/temp.r
Also, the bit after the
#install rstan comment could even be made into a homebrew formula so that users could simply do
brew install rstan.