[R-SIG-Mac] rgl and x11 failures on MacOS

Duncan Murdoch murdoch@dunc@n @end|ng |rom gm@||@com
Tue Feb 9 10:04:56 CET 2021

I have heard a few reports recently that attempting to load rgl causes R 
to freeze up.  This is related to recent problems with MacOS updates or 
XQuartz updates:  people who now can't load rgl also can't run x11() in R.

I haven't experienced the issue myself, but have heard of two possible 
solutions and have one or two workarounds:

Deleting everything from /opt/X11 (and maybe some other related files), 
rebooting the Mac, and reinstalling XQuartz 2.7.11 worked in one case: 
https://github.com/dmurdoch/rgl/issues/11#issuecomment-775595356 .

Explicitly setting the DISPLAY environment variable to :0.0 fixed a 
problem that might be related: 
https://github.com/XQuartz/XQuartz/issues/66#issue-803786687 .

Installing rgl from source using

   install.packages("rgl", configure.args = "--disable-opengl", type = 

is a workaround, but it loses the ability to display rgl output in an 
X11 window from R.  You need to use rglwidget() to do the display in a 
browser, e.g. the one built in to RStudio.  I don't think the browser 
built in to R.app has WebGL support, so it probably won't work.

I'm currently working on changes to the build process so that in the 
future the CRAN binary will be able to run the no-X11 version based on 
setting options(rgl.useNULL = TRUE).

I'd appreciate hearing from anyone who can confirm that setting the 
DISPLAY variable fixes the issue, or more specific detail about what 
needs to be deleted so that the XQuartz install will work.

Duncan Murdoch

More information about the R-SIG-Mac mailing list