[R] quartz() on MAC OSX

jiho jo.irisson at gmail.com
Mon May 21 21:35:15 CEST 2007


On 2007-May-21  , at 08:14 , Rolf Turner wrote:

> I am (desperately) trying to get used to using a Mac here at my new
> location. (Why *anyone* would ever use anything other than Linux,  
> except
> under duress as I am, totally escapes me, but that's another story.)
>

Oh that's harsh, Mac OS X is quite a good citizen and probably one of  
the best Unices out there. It is true that it has "its own way of  
doing things" and that's actually why Mac users love their Mac (there  
is kind of a Mac way of life ;) ). If you try to fight against it,  
you'll loose, but if you try to do things the Mac way, it ends up  
being a very efficient desktop (there are several things I know I  
would really miss if I had to switch back to Linux: smart folders,  
nice antialiased graphics, very good font management etc.)


> Fortunately much of the Mac OSX is actually Unix, so a civilized  
> person can
> manage to carry on ... But there are some things.  (Like this  
> <expletive
> deleted> mailer ... But that's another story.)
>

If you want OS X to be really unix like, use DarwinPorts (or Fink).  
But you need to install additional software and be able to sudo.

OK back to R:


> When I ``open'' R using the icon on the ``dock'' several things are
> unsatisfactory; like I can't clear the screen using system 
> ("clear"), nor can
> I use vi syntax in command line editing.  When I start R from the  
> command
> line (as a civilized person would do) these unsatisfactory  
> circumstances go
> away, but then a new one rears its ugly head:  I can't plot!!!  If  
> I try a
> plot without explicitly opening a plotting device, a postscript  
> device with
> file name ``Rplots.ps'' is silently opened.  If I try opening a  
> device with
> quartz() to get an on-screen plot, I get a warning message
>
> quartz() device interactivity reduced without an event loop manager  
> in:
> quartz()
>
> And a little coloured wheel spins round and round and the quartz()  
> window
> that opens hides underneath the terminal window and appears to be  
> frozen to
> the spot.
>
> Apparently ``it'' wants .Platform$GUI to be equal to "AQUA", but it is
> (under the circumstances) "X11".
>

Yes, this is a known limitation: quartz() has to be started from RGUI  
(or JGR also I think) and can't be started from the terminal without  
some tinkering:
https://stat.ethz.ch/pipermail/r-sig-mac/2004-September/001269.html
[NB: this question is probably more for the R-SIG-Mac mailing list by  
the way]


> Trying to open a device using x11() simply results in an error.
> Is there any way to get a working on-screen graphics window under  
> these
> circumstances?
>

Is X11 installed on you system? Which OS X version do you have?  
Basically you need 2 things to get x11 going from Terminal.app (i.e.  
the mac terminal, not an xterm):
- to install X11 and launch it
- to set the DISPLAY variable (to :0.0 for example)
I have
export DISPLAY=:0.0
in my .bashrc and I can open any x11 application directly from a  
Terminal.

> I am very much hand-cuffed by the officious ITS policies here as to  
> what
> I can install on my Mac.  (Effectively, nothing.)

You *need* to install additional software on a Mac to do anything  
else that email/web/amusement... as with any other platform I guess.  
So you'll need to convince your ITs to give you a little more freedom  
and you'll probably enjoy the Mac afterwards.

If you want a nice terminal replacement try iTerm (and tweak a bit  
the appearance settings to make it easier on the eye). If you want a  
very nice text editor (which can actually interact with RGUI or send  
text to a Terminal with a running R session) try TextMate. It costs  
$40 but it's the only shareware I ever bought and I don't regret a  
cent of it.

Cheers,

JiHO
---
http://jo.irisson.free.fr/
NB: when I find a little time, I'll add some content to this blog  
which details how to get Mac OS X behave a little bit more like  
Linux. Everything is written I just need to proofread it and actually  
post it. Let me know if you are interested.



More information about the R-help mailing list