8

After upgrading to OS X 10.10 Yosemite I started to receive the following error log when running my Rcmdr package in R using library(Rcmdr):

Error : .onLoad failed in loadNamespace() for 'tcltk', details:
  call: dyn.load(file, DLLpath = DLLpath, ...)
  error: unable to load shared object '/Library/Frameworks/R.framework/Versions/3.1/Resources/library/tcltk/libs/tcltk.so':
  dlopen(/Library/Frameworks/R.framework/Versions/3.1/Resources/library/tcltk/libs/tcltk.so, 10): Library not loaded: /usr/X11/lib/libXft.2.dylib
  Referenced from: /usr/local/lib/libtk8.6.dylib
  Reason: image not found
Error: package or namespace load failed for 'Rcmdr'

Could you help me understand how to fix it?

This mac os x troubleshooting didn't help.

astafan8
  • 143
  • 2
  • 7

3 Answers3

20

Execute the following in a terminal window:

locate libXft.2.dylib

or do it from an R console:

system("locate libXft.2.dylib")

On my Yosemite install it's in /opt/X11/lib/libXft.2.dylib.

If your setup is similar, then:

sudo ln -s /opt/X11 /usr/X11

should help fix this temporarily, but I'd keep looking for a Yosemite R package (since that will accommodate all the changes Apple made to the filesystem structure).

Of note: On my work Mac (Mavericks) this symlink is already there.

hrbrmstr
  • 77,368
  • 11
  • 139
  • 205
  • Thank you for your respond! Despite the .dylib is here: /opt/X11/lib/libXft.2.dylib /opt/local/lib/libXft.2.dylib it works now! Could you please explain what was the problem? What changes in file system were made? Are they for the good? – astafan8 Oct 21 '14 at 07:33
  • @user3651816 All of my systems are now on Yosemite so I can't easily confirm, but it looks like Apple just moved X11 from /usr to /opt, whereas R expected it to still be located in /usr. Probably a better solution, if possible, would be to update R's search path to include the correct directory (rather than this janky symlink fix), but I am a relative newb to R so I'm not quite sure myself how one would do that. – Matt Jan 27 '15 at 01:49
  • 1
    The alternative is to re-install XQuartz. Apple didn't move anything, it deleted things during the install (Apple doesn't provide X11 with OS X anymore, even as an add-on). – hrbrmstr Jan 27 '15 at 05:54
  • Well spotted! I would add that, at least in my case, the problems started when updating RStudio to version 0.98.1103. Previously I didn't experience any problem with Yosemite. – jadianes Mar 07 '15 at 21:25
5

Reinstalling XQuartz worked for me.

user4942076
  • 51
  • 1
  • 1
0

I added a symlink from /usr/X11 to /opt/X11 and this resolved the problem without the locate command.

BravoKing
  • 161
  • 2
  • 2