[R-SIG-Mac] R.app doesn't respect DYLD_FALLBACK_LIBRARY_PATH

Steve Lianoglou mailinglist.honeypot at gmail.com
Thu Aug 8 23:01:51 CEST 2013


On Thu, Aug 8, 2013 at 1:42 PM, Tom Schoenemann <toms at indiana.edu> wrote:
> Hello,
> I am trying to get a custom R package (from another group) to run on my system. If I call it from the command line r, it works fine.  If I call it from R.app, it complains with:
> Error in dyn.load(file, DLLpath = DLLpath, ...) :
>   unable to load shared object '/Library/Frameworks/R.framework/Versions/3.0/Resources/library/ANTsR/libs/libRantsRegistration.so':
>   dlopen(/Library/Frameworks/R.framework/Versions/3.0/Resources/library/ANTsR/libs/libRantsRegistration.so, 6): Library not loaded: libitkdouble-conversion-4.5.1.dylib
>   Referenced from: /Applications/image-processing/ANTsR/src/ANTS/ANTS-build/lib/libl_antsRegistration.dylib
>   Reason: image not found
> Error: package or namespace load failed for ‘ANTsR’
> (ANTsR is the package I'm trying to get working)
> I CAN get it to work by doing this on the command line first:
> export DYLD_FALLBACK_LIBRARY_PATH=/Library/Frameworks/R.framework/Resources/lib
> and then also opening the R.app from the command line:
> open /Applications/R.app/
> However, I can't seem to get R.app to know about
> export DYLD_FALLBACK_LIBRARY_PATH=/Library/Frameworks/R.framework/Resources/lib
> unless I do it this way.
> So my questions are:
> 1) how can I get R.app to know about the DYLD_FALLBACK_LIBRARY_PATH?  I tried putting it into my .Renviron file, but it doesn't work  (maybe the syntax is supposed to be different?)
> 2) why does r on the command line know about dynamic libraries, but R.app does not?? This seems like a bug, but maybe there is a good reason for it?

I believe this is due to the phenomenon explained here:

Look for the answer that starts with "Up to and including Lion"

Also you'll find a link to a free preference pane you can install that
lets you handle these things with a GUI (pref pane) -- I've never used
it, but you can find it here:


You could also try to manually set the environment variable in your
working R session, via:

R> Sys.setenv(DYLD_FALLBACK_LIBRARY_PATH="/Library/Frameworks/R.framework/Resources/lib")

not sure if that'll work, but easy enough to try before.

Still -- it's possible that DYLD vars won't work in this way. See this:

Sorry -- no concrete answers here, but hopefully these things will
help you find a workable solution.


Steve Lianoglou
Computational Biologist
Bioinformatics and Computational Biology

More information about the R-SIG-Mac mailing list