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

From: Jarimatti Valkonen <javalkon_at_hytti.uku.fi>
Date: Mon 15 Jan 2007 - 08:20:19 GMT

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?

At least the R GUI reports .Platform$OS.type as "unix" on Mac OS X. Sys.info() gives some additional information:

 > Sys.info()["sysname"]
  sysname
"Darwin"

Note that not all Darwins are necessarily Mac OS X. The R GUI has .Platform$GUI = "AQUA", which I believe is unique to Mac platform. Then again, I have no idea what R installed from sources, MacPorts or Fink reports. The GUI is probably different.

Also note that the Mac OS 10.4 has BSD inside by default, so you may get away with the same code for Unix/Linux and Mac.

HTH,
Jarimatti Valkonen



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Mon Jan 15 19:27:56 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 - 09:30:32 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.