So today I compiled 64 bit R 2.91 on Mac OS X 10.5.7 in order to get maximum speed for my analyses. The speed increase I got was 15-25 %, when I ran some tests with matrix calculation and intensive loops. Note that you can also download optimized binaries from http://r.research.att.com/, although they are not the latest version. Update: This method also works with Snow Leopard 10.6.2 and R 2.10.0.
It took me some effort and googling to get it done so I’m going to post the instructions here, so that I know how to do it next time and I hope that it also benefits others. After I got the installation done I ran into a problem getting ESS to recognize my 64 bit version, but I managed to solve that as well. So here is how I did it:
First I installed the necessary developer tools from http://r.research.att.com/tools/. I already had gcc 4.2 from apple so installed gfortran and libreadline readline-5.2-1-quad.tar.gz. Readline is a precompiled binary and you extract is using
sudo tar fvxz readline-5.2-1-quad.tar.gz -C /
After installing the depencies I extracted R-2.9.1.tar.gz downloaded from cran and executed configure in the extracted directory with the following options (a bit modified from http://r.research.att.com/building.html):
After running “make” and “make install” I had a working installation that can be started using:
R –arch x86_64
Just running R tries to run 32 bit version of R which I don’t have, so I made an alias R=’R–arch=x86_64′ to .profile and R starts form terminal with just the familiar R.
Getting ESS to work
Ok, all was well so far but then I discovered that ESS can’t find R anymore, because it is trying to execute the 32 bit version and doesn’t work. So after looking at the ESS source I discovered that you can modify R startup options in the file “essd-r.el“. I use Carbon Emacs, but this methods should work with other Emacs variants. If you are wondering how to install ESS on OS X have a look at this post.
First give yourself a permission to modify the file:
chmod u+w essd-r.el
Then open it and look for a line that says:
inferior-R-args ” ” ; add space just in case
And chance it to:
inferior-R-args “–arch x86_64 ” ; add space just in case
Thats it, you should now have a working ESS set up with a 64 bit R!