I've installed R on my OS X machine via the .pkg method. I'm trying to get a Ruby gem called RSRuby to work and though it installed correctly, it's throwing an error when I try to invoke the gem.
Fatal error: R home directory is not defined
The RSRuby documentation states that R should be installed with the option --enable-R-shlib. But the R documentation states that the Mac OS X installation does this by default. How can you verify that this option is enabled on an installation if you don't know it was explicitly called during installation?
I'm chasing down why RSRuby can't find R home directory and this seems like the most likely problem.
Per RSRuby documentation, I copied this into my home directory
[~]$ R_HOME=/Library/Frameworks/R.framework/Resource
And from the R console, this is the output:
> R.home()
[1] "/Library/Frameworks/R.framework/Resources"
And during gem install, I ran this command:
gem install rsruby -- --with-R-dir=$R_HOME=/Library/Frameworks/R.framework/Resources
Also, these are the contents of my /Library/Frameworks/R.framework/Libraries folder:
[Libraries]$ ls
i386 libRblas.dylib.dSYM libgfortran.2.dylib
libR.dylib libRblas.vecLib.dylib libreadline.5.2.dylib
libR.dylib.dSYM libRlapack.dylib libreadline.dylib
libRblas.0.dylib libRlapack.dylib.dSYM ppc
libRblas.dylib libgcc_s.1.dylib x86_64
Briefly:
You can check for --enable-R-shlib
by looking at thethe binary of the resulting R built; on Linux I can do ldd /usr/lib/R/bin/exec/R
which reveals that libR.so
--- the shared R library --- is loaded by this binary. That is what other projects embedding R (RInside, littler, the R-in-Apache modules, ...) use and presumably what RSRuby would use.
If you get an error 'R home directory not defined' I would start by defining the environment variable R_HOME
.
Edit: Regaring Question 1, on OS X, your dynamic libraries end in .dylib
. So the directory listing you show clearly demonstrates that R was built with --enable-R-shlib
as a compile-time option. Regarding Question 2, the very first Google hit I got for rsruby os x
clearly describes how to set R_HOME
on OS X (as I had told you), see https://github.com/alexgutteridge/rsruby.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With