Install R with Home Brew under Mac OS X


Blog categories: 

After some years as a MacPorts user I decided to give home brew a try, which are advertising their package manager with the sentence “Homebrew — MacPorts driving you to drink? Try Homebrew!”. The idea is not to build everything from scratch and create another software micro cosmos but to reuse existing Mac OS X abilities and save some space (as well as [cpu] time for updates). Sounds promising I thought and installed it according to the website’s description.

One of the first things I wanted to install was “The R Project for Statistical Computing”. Anyhow, since home brew requires people to think a bit, it was not as straight forward as some MacPorts rules. For R, we need to have a fortran compiler installed. I did this using the following command:

brew install gfortran

Brew would complain otherwise that no fortran compiler is installed and R installation would fail. After that, everything is ready already and we can proceed using:

brew install R

NB! You need to run this command first if you are on a recent OS X:

brew tap homebrew/science

That’s it - no rocket science but nice to know in advance…




Is there any difference so far with the R distribution package for Mac OS X?



Not as far as I know, both provide e. g. 'r 2.14.1'. However, I am not so fond of OS X packages due to uninstallation hassles. On the other hand, the R package provides the R GUI, which is not included in brew's R as far as I know. But I personally prefer RStudio anyways.

Cool! thanks… I'll give it a try.

I don't like OS X packages….. but RStudio comes in one tough :-/

If you appear to have a problem with upgrading or installing R with the folowing error:


brew install gfortran
=⇒ Downloading http://r. research.
Already downloaded: /Users/iss/Library/Caches/Homebrew/gfortran-4.2.4-5666.3.pkg
Error: MD5 mismatch
Expected: 3ccf46da27aaba17 706b420 711fb997e
Got: 7eb140 822c89bec17db5 666 859 868b3b
Archive: ~/Library/Caches/Homebrew/gfortran-4.2.4-5666.3.pkg
(To retry an incomplete download, remove the file above.)
Simply remove the downloaded file (given after 'Archive:') and call
brew install gfortran