08 April 2014

[R] How to compile R package (Hydromad) on Mavericks

[R] Hey R, may I introduce you to Mavericks :-)

I was noticing that R and Mavericks doesn't work-well together. It's because Mavericks keeps using its own new compiler from Xcode 5xx, that different from the standard R package compiler (pls CMIIW). Then install.package command won't work in this situation, including for Hydromad.

So for those of you that mistakenly have upgraded the OS to Mavericks, you have to introduce the right compiler for R package to Mavericks. So it will use it whenever you run install.package command. Thanks to StackOverflow Q&A.

First: You have to download the Xcode 5 from Appstore. It should be properly installed in you Mac. So you don't have to run it.

Second: Run the "terminal' window. The icon should be in your "Utility" program group. The one in the middle.

If your run it the a window like this will open

Third: Then on the terminal prompt type the following code (press "return" after each line):

cd /usr/bin
sudo ln -fs clang llvm-gcc-4.2
sudo ln -fs clang++ llvm-g++-4.2

After that, you should close everything then restart your MBA.

Then you can try again the process to install.package in R from tar.gz file.

Hope it helps. It works on my friend's MBA running Mavericks.

No comments: