Skip Navigation Links
Link to the last RSS article here: A Kinder, Gentler R - An Easier to Install Version of R for the Windows Platform - Ed.
Part I: From The Source - R 2.2.0 on OS-X Tiger 10.4.3
By Patrick McLeod, ACS Research Consultant
Installing R from source on OS-X involves a lot of preparation to get a successful result. Building from the foundation is a sure manner will reward the researcher with a solid statistical application as the end result. Be sure to reference the official R for Max OS-X FAQ: http://cran.r-project.org/bin/macosx/RMacOSX-FAQ.html .
The Right Tools For The Job
The starting point for a successful R installation is the base installation of OS-X. Unless you’ve installed OS-X on your laptop or desktop and know you’ve installed the full X11 suite, stop reading this article and get ready for a new installation of OS-X. The default installation for OS-X does not install the full X11 suite which is required for many open source research tools to compile, install and properly run. Once you’ve backed up and re-installed with the full X11 suite for OS-X, the first thing you need to download and install is the latest version of XCode Tools. This is available from http://developer.apple.com ; there is registration required for this site, but there is no fee for accessing the latest downloads. For this installation, the latest version of XCode Tools is 2.1, released on November 11, 2005. After you’ve downloaded and installed XCode Tools and run a Software Update for you system to insure it is fully patched, you are now ready to collect the dependency packages that form the foundation of the R system: f77, gfortran, teTeX, TCL and TK.
Just as a poorly laid foundation will sabotage a grand mansion built on top of it, 75% of the battle in installing R on OS-X from source is getting the necessary packages in place to satisfy the dependencies for compilation and installation. A package management system is ideal to streamline this process. Fortunately a perfect solution exists for the researcher using OS-X: Fink. Fink ports the functionality of the apt package management system from Debian to OS-X. Finding and installing packages is as easy as apt-get install yourpackagename. Information, instructions and downloads are available from http://fink.sourceforge.net .
Once you’ve downloaded and installed Fink, you’re ready to get the dependencies you need for compilation and installation. OS-X 10.4.3 with a full X11 installation and the latest version of XCode tools will satisfy the requirements for X11 and libreadline. Here are the packages that I either fink installed or apt-get installed to prepare for my R installation: GCC3.3 or later, teTeX , a Fortran 77 compiler (f77 or g77) and for good measure gfortran. In addition to these, I downloaded tar balls of latest versions of TCL and TK from http://www.tcl.tk/software/ .
While the paragraph above reads like these installations will be straightforward and easy, there are always problems with something in these packages. In the several cases where I’ve encountered problems, I’ve found that copying portions of or whole error messages from the command line into Google and searching will result in finding a solution to your problem…or finding that your problem has no solution!
Putting It All Together
After you’ve successfully installed X11, the latest version of XCode tools, Fink, GCC3.3 or later, teTeX, f77, gfortran, TCL and TK, you’re ready to do the easy part: Downloading, compiling and installing and R. R 2.2.0 source is available from http://cran.r-project.org/src/base/R-2/R-2.2.0.tar.gz . Once you’ve downloaded the source code, issue the following commands to untar, compile and install R on your system:
To run R from the command line, you’ll want to set up a symbolic link to the R installation inside your library frameworks. Assuming that /usr/local/bin is in your path, the following line will get it all working:
Now you can type R at a command prompt and invoke R 2.2.0:
To recap, the most important pieces of installing R on OS-X are X11, the most current version of XCode tools, GCC3.3 or later, teTeX, f77, gfortran, TCL and TK. You don’t have to install this through Fink, but it will make life much easier if you do.
In Part II, we’ll build R.app (for the R GUI) using XCode and explore the R GUI.