Skip to content

Instantly share code, notes, and snippets.

@oousmane
Created October 28, 2025 07:50
Show Gist options
  • Save oousmane/4276c47ce747a73d8f69906b06fd2091 to your computer and use it in GitHub Desktop.
Save oousmane/4276c47ce747a73d8f69906b06fd2091 to your computer and use it in GitHub Desktop.
Consistent way to detect os automatically by the creator of geoplumber
get_os <- function(){
sysinf <- Sys.info()
if (!is.null(sysinf)){
os <- sysinf['sysname']
if (os == 'Darwin')
os <- "osx"
} else { ## mystery machine
os <- .Platform$OS.type
if (grepl("^darwin", R.version$os))
os <- "osx"
if (grepl("linux-gnu", R.version$os))
os <- "linux"
}
tolower(os)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment