Skip to content

Instantly share code, notes, and snippets.

@inventionate
Last active August 31, 2023 18:27
Show Gist options
  • Save inventionate/1a752af7c0ad7c89067979fbb02dbee3 to your computer and use it in GitHub Desktop.
Save inventionate/1a752af7c0ad7c89067979fbb02dbee3 to your computer and use it in GitHub Desktop.
Install R with OpenBLAS via Homebrew
# Stat Installation
# XCode CLT
xcode-select --install
# Update Homebrew
brew update
# Check for broken dependencies and/or outdated packages
brew doctor
brew prune
# R
brew install openblas --with-openmp
brew install r --with-openblas
echo ".libPaths('~/Library/R/3.4/library')" >> ~.RProfile
# data.table with enabled OpenMP
brew install llvm
echo 'export PATH="/usr/local/opt/llvm/bin:$PATH"' >> ~/.bashrc
mkdir ~/.R
echo "CC=/usr/local/opt/llvm/bin/clang -fopenmp
CXX=/usr/local/opt/llvm/bin/clang++
# -O3 should be faster than -O2 (default) level optimisation .
CFLAGS=-g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe
CXXFLAGS=-g -O3 -Wall -pedantic -std=c++11 -mtune=native -pipe
LDFLAGS=-L/usr/local/opt/gettext/lib -L/usr/local/opt/llvm/lib -Wl,-rpath,/usr/local/opt/llvm/lib
CPPFLAGS=-I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include" >> ~/.R/Makevars
# data.table
R --vanilla << EOF
install.packages('data.table', repos='https://cloud.r-project.org/')
q()
EOF
rm ~/.R/Makevars
echo "CC=/usr/local/opt/llvm/bin/clang
CXX=/usr/local/opt/llvm/bin/clang++" >> ~/.R/Makevars
# devtools
R --vanilla << EOF
install.packages('devtools', dependencies=TRUE,
repos='https://cloud.r-project.org/')
q()
EOF
# testthat
R --vanilla << EOF
install.packages('testthat', dependencies=TRUE,
repos='https://cloud.r-project.org/')
q()
EOF
# roxygen2
R --vanilla << EOF
install.packages('roxygen2', dependencies=TRUE,
repos='https://cloud.r-project.org/')
q()
EOF
# rlang
R --vanilla << EOF
install.packages('rlang', dependencies=TRUE,
repos='https://cloud.r-project.org/')
q()
EOF
# knitr
R --vanilla << EOF
install.packages('knitr', dependencies=TRUE, repos='https://cloud.r-project.org/')
q()
EOF
# rmarkdown
R --vanilla << EOF
install.packages('rmarkdown', dependencies=TRUE,
repos='https://cloud.r-project.org/')
q()
EOF
# bookdown
R --vanilla << EOF
install.packages('bookdown', dependencies=TRUE,
repos='https://cloud.r-project.org/')
q()
EOF
# tidyverse
R --vanilla << EOF
install.packages('tidyverse', dependencies=TRUE,
repos='https://cloud.r-project.org/')
q()
EOF
# ggrepel
R --vanilla << EOF
install.packages('ggrepel', dependencies=TRUE,
repos='https://cloud.r-project.org/')
q()
EOF
# gganimate
R --vanilla << EOF
install.packages('gganimate', dependencies=TRUE,
repos='https://cloud.r-project.org/')
q()
EOF
# ggthemes
R --vanilla << EOF
install.packages('ggthemes', dependencies=TRUE,
repos='https://cloud.r-project.org/')
q()
EOF
# ggmap
R --vanilla << EOF
install.packages('ggmap', dependencies=TRUE,
repos='https://cloud.r-project.org/')
q()
EOF
# RColoBrewer
R --vanilla << EOF
install.packages('RColorBrewer', dependencies=TRUE,
repos='https://cloud.r-project.org/')
q()
EOF
# dendextend
R --vanilla << EOF
install.packages('dendextend', dependencies=TRUE,
repos='https://cloud.r-project.org/')
q()
EOF
# kml3d
R --vanilla << EOF
install.packages('kml3d', dependencies=TRUE,
repos='https://cloud.r-project.org/')
q()
EOF
# GDAtools
R --vanilla << EOF
install.packages('GDAtools', dependencies=TRUE,
repos='https://cloud.r-project.org/')
q()
EOF
# FactoMineR
R --vanilla << EOF
install.packages('FactoMineR', dependencies=TRUE,
repos='https://cloud.r-project.org/')
q()
EOF
# FactoInvestigate
R --vanilla << EOF
install.packages('FactoInvestigate', dependencies=TRUE,
repos='https://cloud.r-project.org/')
q()
EOF
# missMDA
R --vanilla << EOF
install.packages('missMDA', dependencies=TRUE,
repos='https://cloud.r-project.org/')
q()
EOF
# factoextra
R --vanilla << EOF
install.packages('factoextra', dependencies=TRUE,
repos='https://cloud.r-project.org/')
q()
EOF
# showtext
R --vanilla << EOF
install.packages('showtext', dependencies=TRUE,
repos='https://cloud.r-project.org/')
q()
EOF
# sysfonts
R --vanilla << EOF
install.packages('sysfonts', dependencies=TRUE,
repos='https://cloud.r-project.org/')
q()
EOF
# Hmisc
R --vanilla << EOF
install.packages('Hmisc', dependencies=TRUE,
repos='https://cloud.r-project.org/')
q()
EOF
# explor
R --vanilla << EOF
install.packages('explor', dependencies=TRUE,
repos='https://cloud.r-project.org/')
q()
EOF
# questionr
R --vanilla << EOF
install.packages('questionr', dependencies=TRUE,
repos='https://cloud.r-project.org/')
q()
EOF
# archivist
R --vanilla << EOF
install.packages('archivist', dependencies=TRUE,
repos='https://cloud.r-project.org/')
q()
EOF
# archivist.github
R --vanilla << EOF
install.packages('archivist.github', dependencies=TRUE,
repos='https://cloud.r-project.org/')
q()
EOF
# shiny
R --vanilla << EOF
install.packages('shiny', dependencies=TRUE,
repos='https://cloud.r-project.org/')
q()
EOF
# learnr
R --vanilla << EOF
install.packages('learnr', dependencies=TRUE,
repos='https://cloud.r-project.org/')
q()
EOF
# pacman
R --vanilla << EOF
install.packages('pacman', dependencies=TRUE,
repos='https://cloud.r-project.org/')
q()
EOF
# TimeSpaceAnalysis
R --vanilla << EOF
pacman::p_install_gh("inventionate/TimeSpaceAnalysis", dependencies=TRUE)
q()
EOF
@inventionate
Copy link
Author

Es besteht ein Problem mit x11(). Die Nutzung von KML ist daher nur eingeschränkt möglich.

@dkreeft
Copy link

dkreeft commented Aug 3, 2019

Thank you for the script. Unfortunately, homebrew does not accept install option flags anymore and thus the instructions are more or less useless now. I found a guide here that does work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment