Installing R with Homebrew
As of 2017 / Brew 1.3.2 @ macOS Sierra 10.12.6 all you have to do is:
$ brew install r
You don't even need to tap homebrew/science since r is now a part of core formulae for the Homebrew (homebrew-core).
It will also install all dependencies automatically:
==> Installing dependencies for r: gmp, mpfr, libmpc, isl, gcc
There are two additional options you might want to know:
--with-java
Build with java support
--with-openblas
Build with openblas support
As of 2017, it's just brew install r
. See @Andrew's answer below.
As of 2014 (using an Yosemite), the method is the following:
brew tap homebrew/science
brew install Caskroom/cask/xquartz
brew install r
The gcc
package (will be installed automatically as a required dependency) in the homebrew/science
tap already contains the latest fortran compiler (gfortran
), and most of all: the whole package is precompiled so it saves you a lot of compilation time.
This answer will also work for El Capitan and Mac OS Sierra.
In case you don't have XCode Command Line Tools (CLT), run from terminal:
xcode-select --install
I used this tutorial to install R on my mac, and it had me install xquartz
and a fortran complier (gfortran
) as well.
My suggestion would be to brew untap homebrew/science
and then brew tap homebrew/science
and try again, also, make sure you don't have any errors when you run brew doctor
Hope this helps