Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

How do I install "R" on OS X? Ideally using Homebrew?

There seems to be very little information online.

share|improve this question

6 Answers 6

Install Homebrew (if needed)

ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"

Install R

brew tap homebrew/science
brew install r
share|improve this answer
    
I also ran "brew install gfortran" beforehand, but I don't think it was necessary. If someone could please confirm... –  matt burns Feb 18 at 12:18
5  
Indeed, Homebrew should automatically install all required dependencies. –  grgarside Feb 18 at 12:21
1  
With this method are you able to install packages from CRAN? I was unable to get packages from CRAN to install correctly when I installed R using brew. When I switched to a copy of R downloaded directly from CRAN, my problems went away. –  Rob Donnelly Feb 18 at 21:41

In addition to the homebrew suggestion, you can just download the binary from http://www.r-project.org/

  1. Go to http://www.r-project.org/
  2. Click CRAN
  3. Select a mirror
  4. Click "download R for (Mac) OS X"
  5. Download and install the latest pkg binary

See also the R for Mac OSX FAQ that includes information on installation.

share|improve this answer

You can download R for Mac OS X simply from here : http://cran.cnr.berkeley.edu

Hit the button : Download R for (Mac) OS X

Install the PKG file that came in the download.

This website might help to go ahead and download home-brew / install home brew as well.

https://github.com/Homebrew/homebrew/wiki/Installation

share|improve this answer

I'm a fan of RStudio. It's an IDE that wraps R, makes visualization, organization, debugging, and other tasks much easier. Or, you can just use it as if it were a simple install of R. There's a Mac binary available from that website.

share|improve this answer

1.- http://cran.r-project.org/bin/macosx/ and download in Mac-GUI-1.62.tar.gz. 2.- INSTALL

You need R built and installed as a framework: see the 'R Installation and Administration Manual'. A CRAN binary install of R suffices.

Building R.app

Only Mac OS X 10.6 and higher are supported, and only 64-bit R. The project is called "R.xcodeproj" and requires Xcode 3.2 or higher.

The project can be built by selecting "R" target and "Build" inside the XCode GUI.

Supported configurations are: SnowLeopard64 (release, current OS X, default) Lion64 (release, OS X 10.7+, Xcode 4.5+) MLion64 (release, OS X 10.8+, Xcode 4.5+) Debug (with debugging output, current OS X)

The configurations differ mainly in the SDK selected (recent versions of Xcode only support the current and immediately previous SDKs, so for example in Mar 2013 the default would build for 10.8, but configuration Lion64 allows building for >= 10.7).

To build the project from the command line in the Mac-GUI directory use something like: xcodebuild -target R -configuration SnowLeopard64

To build the R for Mac OS X FAQ use either xcodebuild -target Docs or manually in docs folder makeinfo -D UseExternalXrefs --html --force --no-split RMacOSX-FAQ.texi

The resulting html FAQ file will be found in Mac-GUI/docs directory.

Note about binary compatibility:

The general rules for R apply, that is binary compatibility is given only if the major and minor version numbers match - only the patch level may differ. When using the X.Y.Z version form it means that X.Y must match. For example R-GUIs linked to 3.0.x and 3.1.x are NOT binary compatible.

The compiled R.app is usually bound to a specific version, such as 3.0.1. If you upgrade R removing the older version, let's say using R.app built for 3.0.0 and updating R to 3.0.1, you may need to fix the absolute path to libR.dylib. The nightly builds use a generic path /Library/Frameworks/R.framework/Resources/lib/libR.dylib which points to the latest version of R, but this is done by an additional call to install_name_tool in the building script. Release versions of the GUI use a fixed-version path as they come with a specific R version (in fact the default behavior doesn't depends on the GUI, but on libR.dylib - changing its own reference entry changes the way R.app is linked).

share|improve this answer

After following Matt Burns' answer, you can then install the R.app GUI via brew:

$ brew install r-gui
$ brew linkapps  # creates symlinks in /Applications
$ open /Applications/R.app  # or via Applications menu
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.