7

I installed the rgl package (0.104.16) in R (3.6.3), but it does not load. I don't get any errors. It just never ends loading. I tried reinstalling R and RStudio and also Xquartz. Nothing is working. I have Mac OS Catalina version 10.15.7. Any help would be highly appreciated! Cheers

Nolozz
  • 71
  • 1
  • 1
  • 3

2 Answers2

13

Edited to add new details and suggested fixes.

This appears to be due to problems in the 2.8.0beta version of Xquartz that was released in early February. There are two problems:

  • It makes incompatible changes to libX11.6.dylib, so programs (like the CRAN binaries of rgl) that were built for the 2.7.11 release will not work. If you build rgl (and everything else that uses X11) from source, it may be okay -- it was for me.

  • When you uninstall it, it leaves behind two programs that run at startup: /Library/LaunchDaemons/org.xquartz.startx.plist (runs when you reboot your system) and /Library/LaunchAgents/org.xquartz.startx.plist (runs when you login). If you then install 2.7.11, these will fail to run (probably because of the libX11 change mentioned above). At that point, nothing in X11 works.

So the solution appears to be:

  • Uninstall XQuartz by dragging it from the Applications/Utilities folder to the trash.
  • Uninstall rgl by running remove.packages("rgl") in R.
  • Delete those two files named org.xquartz.startx.plist from /Library/LaunchDaemons and /Library/LaunchAgents.
  • Reboot your system to remove the processes started from those files.
  • Reinstall XQuartz 2.7.11.
  • Reinstall rgl either from CRAN or from source.

If I'm wrong and that process doesn't work, this will almost certainly work as long as your rgl version is at least 0.105.12 (but won't give you any rgl windows):

# Start a new session
options(rgl.useNULL = TRUE)
library(rgl)

To see your displays, run the rglwidget() function, and they'll display in a browser or the RStudio viewer pane.

user2554330
  • 37,248
  • 4
  • 43
  • 90
  • this seems to work when installing the rgl package "manually". but is there a way to implement this solution when rgl is installed as a dependency during the R_CMD_check of Github Actions? (sorry if this is a dumb question) – yasel Mar 30 '21 at 13:23
  • 3
    @yasel: set environment variable `RGL_USE_NULL: true` in the `env:` section of your action, and it won't be an issue. – user2554330 Mar 30 '21 at 20:17
  • how do I find Applications/Utilites to deleted Quartz on a Mac? Or put differently: how shall I know where this file is if I cannot even find it on my computer. I am pretty sure it causes my current problems. – canIchangethis Oct 12 '21 at 11:54
  • @canIchangethis: `Applications` is normally listed in the Finder as a "favorite". If it's not there, it should be in `/Applications` in the root directory of your main drive. `Applications/Utilities` is a folder within it. – user2554330 Oct 12 '21 at 12:51
  • Oh thanks! I found it - for some reason it was named different in my mac's language – canIchangethis Oct 12 '21 at 12:58
  • Thanks for a great answer. To reinstall with Homebrew [this](https://stackoverflow.com/questions/58373704#66477916) answer also helps. – daviestar Jan 28 '22 at 11:31
  • It appears to me that xquartz `2.8.1` does not have this problem, so if so, is it not better to install that rather than `2.7.11`? – Obromios May 16 '22 at 01:05
1

I installed XQuartz 2.8.5, restarted my M1 Mac, and i could install and run the rayshader demo. the problem apparently was that rgl had x386 libraries but not ARM ones (or at least aliases to them), but installing the latest XQuartz fixed that without having to fiddle with removing files

redantman
  • 11
  • 1