Re: [R] How to detect if R is running on Mac OS X?

From: Prof Brian Ripley <>
Date: Mon 15 Jan 2007 - 09:39:39 GMT

I think there are two different questions here:

  1. Is R running under darwin, the underlying OS of MacOS X? You can test that by or R.version$platform. It seems unlikely that you would need this. We do need to distinguish darwin at C level, as it is a very unusual 'unix', a much-modified version of FreeBSD. One thing that does show up at R level is the use of DYLD_LIBRARY_PATH rather than LD_LIBRARY_PATH.
  2. Is R runnng as part of the GUI? For that, test .Platform$GUI (it is I believe "AQUA" iff is in use).

On Mon, 15 Jan 2007, Philippe Grosjean wrote:

> This question is probably trivial, but I don't find the answer. I have
> code that is different for Windows, Unix/Linux and Mac OSX. The man page
> of .Platform tells that .Platform$OS.type is the right way to test for
> it... but it also tels that it returns either "windows" or "unix". Is
> Mac OS X reported as "unix"? If yes, how do I make the difference?
> Thanks,
> Philippe Grosjean

Brian D. Ripley,        
Professor of Applied Statistics,
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________ mailing list
PLEASE do read the posting guide
and provide commented, minimal, self-contained, reproducible code.
Received on Mon Jan 15 20:46:15 2007

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Mon 15 Jan 2007 - 10:30:33 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.