You can check whether you are running OS X using Sys.info()["sysname"] == "Darwin".
On Windows, finer control is possible by checking for specific versions of the OS using utils::win.version().
How do you check the version of OS X? (I can't find a mac.version or osx.version function. There are some low-level OS commands for finding the version, but I'm not aware of any R wrapper.)
Do Sys.info()["release"] or system("uname --kernel-release", intern = TRUE) return anything useful? (I don't have a machine to check.)