From ripley at stats.ox.ac.uk  Thu Sep 20 13:41:55 2007
From: ripley at stats.ox.ac.uk (Prof Brian Ripley)
Date: Thu, 20 Sep 2007 12:41:55 +0100 (BST)
Subject: [Rd] How to test if R is running on a Mac
In-Reply-To: <0A639C18-F8ED-4514-88CE-96258C68BBC8@mclink.it>
References: <F189E18BBAA8B6479F618B9044CF4E9C0188517825@owa.bfro.uni-lj.si>
	<46F1335C.6050107@stats.uwo.ca>
	<59d7961d0709191351l1c4f1b22t84a1db9b246ba26c@mail.gmail.com>
	<46F1A4C0.9030702@cimr.cam.ac.uk>
	<0A639C18-F8ED-4514-88CE-96258C68BBC8@mclink.it>
Message-ID: <Pine.LNX.4.64.0709201224370.16338@gannet.stats.ox.ac.uk>

On Thu, 20 Sep 2007, stefano iacus wrote:

> what about
>
> > system("uname")
> Darwin

Why not use Sys.info() or R.version to find that?

> stefano
> p.s. if one day R will run on the iPhone, you have to change the
> question below into "Do you see an apple logo somewhere on your
> device?")

And in any case other OSes run on Apple hardware: I believe several R 
developers use a MacBook to run Windows or Linux.  Beyond that, R could be 
running remotely, not on the computer to which the keyboard is attached.
Then there is virtualization which allows one OS to run under another.

So I don't if the question was really

- is R running on Mac hardware
- is R running under MacOS X GUI
- is R running under Darwin
...

which all seem reasonable questions, but different ones.  (MacOS X vs 
Darwin is similar to Solaris vs SunOS: the first of the pair includes a 
user interface and not just an OS.)


>
> On 20/set/07, at 00:37, Hin-Tak Leung wrote:
>
>> On linux boxes,
>>    version$os and R.version$os
>> is 'linux-gnu'. I assume that it would be 'darwin-apple' on
>> Mac's?
>>
>> Henrik Bengtsson wrote:
>>> isApple <- function(...) {
>>>   isApple <- FALSE;
>>>   tryCatch({
>>>     ans <- readline("Do you see an Apple key on the keyboard you are
>>> typing on? yes/no");
>>>     isApple <- (ans == "yes");
>>>   }, mouseClick = function(ex) {
>>>     isApple <<- TRUE;
>>>   })
>>> }
>>>
>>> /H
>>>
>>>
>>> On 9/19/07, Duncan Murdoch <murdoch at stats.uwo.ca> wrote:
>>>> On 9/19/2007 9:41 AM, Gorjanc Gregor wrote:
>>>>> Hi!
>>>>>
>>>>> Is there any way to test if R is running on a Mac? I usually use
>>>>> value of .Platform$OS.type for windows or unix, but Mac falls in
>>>>> the
>>>>> latter group.
>>>> Remember to also look at .Platform$GUI:  the GUI version behaves
>>>> quite
>>>> differently from command line R from a user's point of view (both
>>>> on the
>>>> Mac and on Windows), and occasionally from a programmer's point
>>>> of view
>>>> (e.g. the graphics device on the Mac).
>>>>
>>>> Duncan

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



[Rd] How to test if R is running on a Mac
Prof Brian Ripley