Installing R in OS X with Homebrew and Cask

Installing R in OS X with Homebrew and Cask

I can install the R language for statistics and environment for statistical computing and graphics from the CRAN site and it is a simple install from the CRAN site and probably recommended for most folks.

I wanted to build it from source, but doing so without a safety net  was beyond the investment, in time to refresh my build from source skills, that I was willing to make. With Homebrew and the Homebrew Cask add-on it is definitely approachable. It still takes more time that the CRAN install, but less technical input and the time investment is copy and pasting the commands into the terminal and waiting, considerable waiting, for each program to be compiled.

The compiling time for me was on my MacAir with i7 and it did warm up and employ the fan. I followed the fine outline provided by Bob Rudis aka “hrbrmstr” with a Twitter handle by the same. I ran across his blog-post on R-bloggers titled Installing R on OS X – “100% Homebrew Edition” of date October 22, 2015, and is actually a duplicate from rud.is with the same title.

The following is lifted directly from Bob Rudis’s posts. Tip of the hat to ya’ Bob. I have placed it here so that I have easy access. Please go to his posts to get his excellent notes.

brew tap caskroom/cask
brew install brew-cask
 
brew install Caskroom/cask/xquartz
brew cask install java
 
brew tap homebrew/science
brew install R
 
brew install Caskroom/cask/rstudio
 
 
# For latex:
 
brew cask install mactex
 
# OR YOU CAN DO
 
brew cask install basictex # suggested by @noamross
 
# DO NOT DO BOTH!
 
brew install libsvg curl libxml2 gdal geos boost
 
R CMD javareconf JAVA_CPPFLAGS=-I/System/Library/Frameworks/JavaVM.framework/Headers
 
brew tap caskroom/fonts
brew cask install font-fira-code
brew cask install iterm2

Update.

when running brew update sometimes it reports that /usr/local is not writable. Then run

sudo chown -R $(whoami) /usr/local

That’s it.

Leave a Reply