[R-SIG-Mac] Mac OS X tcltk/X11 issues

John Fox jfox at mcmaster.ca
Tue Jul 15 06:37:19 CEST 2014


Hi Gabor,

Thanks for the clarification.

I agree that it would be best to intercept the problem on Linux/Unix as well as on Mac OS X. Do you know that X11 is necessary for the tcltk package to work on Linux/Unix systems (or is there possibly a non-X11 Tcl/Tk there that's compatible with the tcltk package)?

As a practical matter, the problem occurs with some regularity on Mac OS X (I'm aware that the availability and default installation of X11 varies by version of the OS), but I've not seen a report of it on Linux, so my immediate concern was to solve the problem on Mac OS X.

Best,
 John

On Mon, 14 Jul 2014 21:37:54 -0400
 Gábor Csárdi <csardi.gabor at gmail.com> wrote:
> Hi John,
> 
> On Mon, Jul 14, 2014 at 8:12 PM, John Fox <jfox at mcmaster.ca> wrote:
> > Dear Gabor,
> >
> > As I just explained, the problem isn't testing for X11, which I know how to do -- though capabilities("X11") is a bit better than what I suggested. The issue is specific to Mac OS X because the Windows implementation of R includes a Tcl/Tk that doesn't use X11, and I've never seen the problem on Linux.
> 
> actually, what I am saying is, that it is not specific to OSX. Some
> (older, before 2012) OSX versions do include an X11 server, and some
> Linux or other Unix installations do not.
> 
> I am not saying tcltk should not test for an X11 server, all I am
> saying is that the test suggested below (based on the os and the
> existence of a certain file) is not the best one.
> 
> If it turns out that there is no X11 server, and the os is OSX, then
> indeed a dialog box could be displayed, see e.g. the one at
> http://www.macrumors.com/2012/02/17/apple-removes-x11-in-os-x-mountain-lion-shifts-support-to-open-source-xquartz/
> 
> Best,
> Gabor
> 
> > Best,
> >  John
> >
> >> -----Original Message-----
> >> From: Gábor Csárdi [mailto:csardi.gabor at gmail.com]
> >> Sent: Monday, July 14, 2014 6:37 PM
> >> To: Marc Schwartz
> >> Cc: John Fox; urbanek at research.att.com; R-SIG-Mac
> >> Subject: Re: [R-SIG-Mac] Mac OS X tcltk/X11 issues
> >>
> >> What's wrong with capabilities("X11")?
> >>
> >> I am not sure if teting for the OS, and especially for a particular X
> >> server, installed in a particular directory, is a good idea, even if
> >> it covers most of the _current_ installations.
> >>
> >> Gabor
> >>
> >> On Mon, Jul 14, 2014 at 6:13 PM, Marc Schwartz <marc_schwartz at me.com>
> >> wrote:
> >> >
> >> > On Jul 14, 2014, at 4:53 PM, Marc Schwartz <marc_schwartz at me.com>
> >> wrote:
> >> >
> >> >> On Jul 14, 2014, at 4:13 PM, John Fox <jfox at mcmaster.ca> wrote:
> >> >>
> >> >>> Dear Simon and list members,
> >> >>>
> >> >>> As many of you are aware, when X11 isn't installed on Mac OS X,
> >> loading the
> >> >>> tcltk package produces an error, with a message that many users
> >> find
> >> >>> cryptic. There was yet another instance of this problem reported to
> >> the list
> >> >>> today.
> >> >>>
> >> >>> I'm interested in the issue because the Rcmdr package uses tcltk
> >> and thus
> >> >>> fails to load when X11 is absent. Rcmdr users tend to be
> >> inexperienced and
> >> >>> so, unless they find their way to the Rcmdr installation webpage,
> >> where
> >> >>> detailed installation instructions are provided, they tend to be
> >> stymied by
> >> >>> the problem.
> >> >>>
> >> >>> If I could, I'd intercept the problem by checking
> >> capabilities()["X11"] in
> >> >>> the Rcmdr .onLoad() or .onAttach() function, but because the Rcmdr
> >> package
> >> >>> imports the tcltk namespace, the error occurs before these startup
> >> functions
> >> >>> are executed -- a chicken-and-egg problem.
> >> >>>
> >> >>> It occurs to me that tcltk could fail more gracefully on Mac OS X
> >> when X11
> >> >>> is absent, perhaps popping up a webpage in a browser with
> >> instructions and a
> >> >>> link for installing XQuartz. I'd do this myself in the Rcmdr
> >> package if I
> >> >>> could. Or tcltk could check for the presence of X11 and not try to
> >> start it
> >> >>> if it's absent, reporting a warning rather than throwing an error.
> >> >>>
> >> >>> Alternatively, I'd be grateful if someone could suggest how I might
> >> detect
> >> >>> the problem in the Rcmdr package before loading fails. The only
> >> thing that I
> >> >>> could think of was writing a separate RcmdrInstall package that
> >> bypasses
> >> >>> tcltk, but that would be awkward and would only help users who
> >> discovered
> >> >>> that RcmdrInstall exists.
> >> >>>
> >> >>> Thanks,
> >> >>> John
> >> >>
> >> >>
> >> >> John,
> >> >>
> >> >> Is there someplace in your startup process where you could run code
> >> along the lines of:
> >> >>
> >> >> if (grepl("apple", R.version$platform) &
> >> length(list.files("/opt/X11/bin", pattern = "Xquartz")) == 0) {
> >> >>     cat("X11 is required. Please visit http://xquartz.macosforge.org
> >> to download and install Xquartz.")
> >> >>     stop()
> >> >> }
> >> >>
> >> >>
> >> >> The above code will check to see if the user is running R on OS X
> >> and also if the Xquartz binary is present in the default location.
> >> >>
> >> >> Not sure if this is helpful.
> >> >
> >> >
> >> > A possible correction in the above code relative to detecting OS X:
> >> >
> >> > if ((Sys.info()["sysname"] == "Darwin") &
> >> length(list.files("/opt/X11/bin", pattern = "Xquartz")) == 0) {
> >> >     cat("X11 is required. Please visit http://xquartz.macosforge.org
> >> to download and install Xquartz.")
> >> >     stop()
> >> > }
> >> >
> >> >
> >> > I believe that Sys.info()["sysname"] == "Darwin" is preferred for
> >> detecting the OS that R is running on versus the OS that it was built
> >> upon according to the help files, if I read correctly. This could be
> >> important if someone is building R from source versus installing
> >> Simon's CRAN binary, I presume.
> >> >
> >> > Regards,
> >> >
> >> > Marc
> >> >
> >> > _______________________________________________
> >> > R-SIG-Mac mailing list
> >> > R-SIG-Mac at r-project.org
> >> > https://stat.ethz.ch/mailman/listinfo/r-sig-mac
> >



More information about the R-SIG-Mac mailing list