Tag Archives: OS X 10.9

Making R and Mavericks Play Nicely

Around the end of October, Apple released its latest version of OS X, 10.9 – Mavericks.  After a couple weeks of seeing my fellow classmates not having any problems downloading and installing it, I decided to do the same.  Little did I realize that the installation of the new OS deleted all of the files for the gcc and g++ compilers.  That was a shock to me when I first tried to compile/run a C++ program after the update.  I then downloaded the new version of XCode to go with Mavericks, and re-downloaded/installed the command line tools.  C/C++ files could then compile and run on my computer once again.  Yay!!

Then came using R for our research work…

When I tried using R again for writing code for this research project, I ran into some really strange problems that I had not had before with the R interpreter that I use (http://www.r-project.org/).  Somehow just trying to load a library that I had not downloaded and installed yet resulted in R running into a segmentation fault and basically crashing instead of just giving me a friendly error message.  Not cool.  I figured there had to be something strange going on between R and Mavericks, so I did some research.  I learned that Mavericks was no longer using the usual gcc/g++ compiler, and instead changed to clang.  Thanks Apple.  What did this mean for getting R up and running again?  First, I had to dig into the makeconf file for R and change a couple settings in there to use clang and clang++ instead of gcc and g++.  Then I had to download and install the latest version of the R interpreter.

Thankfully overall this was a less painful process than I had been expecting, and R now works wonderfully!  Also, my research work in solving this issue was passed on to the department’s personal IT guy to use on all the Apple computers in the labs.  😀

Below are links to a couple of the websites that I read through when researching the fix to this problem:
http://stackoverflow.com/questions/19533220/cannot-install-r-package-from-source-in-mac-osx-maverick
(Do not make the suggested CXXFLAGS change!  -O3 adds a ton of other compiler optimization flags that alter the code at compilation for faster execution, but can also add unintended bugs.)
http://citizen-statistician.org/2013/10/27/warning-mac-os-10-9-mavericks-and-r-dont-play-nicely/
http://blog.gmane.org/gmane.comp.lang.r.mac

Happy Holidays!

Leave a comment

Filed under Uncategorized