Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing R with Homebrew

Tags:

homebrew

r

I'm trying to install R using Homebrew. I ran these commands which are recommended elsewhere on SO:

brew tap homebrew/science
brew install R

For brew tap homebrew/science, I'm receiving this error:

Error: Already tapped!

For the second command, I receive this:

Error: No available formula for r 

Any suggestions?

like image 616
duber Avatar asked Sep 25 '22 20:09

duber


People also ask

Can you install R on Mac?

To install R on a Mac, click the “Download R for Mac” link. Next, click on the R-3.0. 3 package link (or the package link for the most current release of R). An installer will download to guide you through the installation process, which is very easy.

How do I manually install an R package?

Go into R, click on Packages (at the top of the R console), then click on "Install package(s) from local zip files", then find the zip file with arm from wherever you just saved it. Do the same thing to install each of the other packages you want to install.

Where is R installed Mac?

The typical installation will install the GUI into the /Applications/R. app folder and the R framework into the /Library/Frameworks/R. framework folder.


2 Answers

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
like image 124
Andrew Avatar answered Oct 06 '22 19:10

Andrew


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
like image 235
haddr Avatar answered Oct 06 '22 18:10

haddr