Installing R with Homebrew

RHomebrew

R Problem Overview


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?

R Solutions


Solution 1 - R

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

Solution 2 - R

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

Solution 3 - R

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

Solution 4 - R

brew install cask
brew cask install xquartz
brew tap homebrew/science
brew install r

This way, everything is packager managed, so there's no need to manually download and install anything.

Solution 5 - R

Working on El Capitan 10.11.1, the steps I followed are

brew install cask    
brew tap homebrew/science    
brew install r

Solution 6 - R

This is what actually worked for me on OSX Yosemite.

brew install cask
brew install Caskroom/cask/xquartz
brew install r

Solution 7 - R

If you run

xcode-select --install

you do you not need to install gcc through brew, and you will not have to waste time compiling gcc. See https://stackoverflow.com/a/24967219/2668545 for more details.

After that, you can simply do

brew tap homebrew/science
brew install Caskroom/cask/xquartz
brew install r

Solution 8 - R

I am working MacOS 10.10. I have updated gcc to version 4.9 to make it work.

brew update
brew install gcc
brew reinstall r

Solution 9 - R

brew install homebrew/science/r

works on OS X 10.11.6.

Solution 10 - R

If you meant "r" specifically:
It was migrated from homebrew/science to homebrew/core.

For r 3.4.3 Mac High Sierra:

brew tap homebrew/core
brew install Caskroom/cask/xquartz
brew install r

Solution 11 - R

You can also install R from this page:

https://cran.r-project.org/bin/macosx/

It works out of the box

Solution 12 - R

homebrew/science was deprecated So, you should use the following command.

brew tap brewsci/science

Solution 13 - R

As per the homebrew page, it is installed with the following command:

brew install --cask r

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionduberView Question on Stackoverflow
Solution 1 - RhaddrView Answer on Stackoverflow
Solution 2 - RAndrewView Answer on Stackoverflow
Solution 3 - Rstrivedi183View Answer on Stackoverflow
Solution 4 - RXander DunnView Answer on Stackoverflow
Solution 5 - Ra.boseView Answer on Stackoverflow
Solution 6 - RJoseph LustView Answer on Stackoverflow
Solution 7 - RThinkBonoboView Answer on Stackoverflow
Solution 8 - RJoshuaView Answer on Stackoverflow
Solution 9 - RecoeView Answer on Stackoverflow
Solution 10 - RAmirView Answer on Stackoverflow
Solution 11 - RgeorgeView Answer on Stackoverflow
Solution 12 - RJS.ParkView Answer on Stackoverflow
Solution 13 - RsharshiView Answer on Stackoverflow