Library to get OS information (arch, system, distribution, release ...)

Is there any lib that I can use in order to get OS information such as (yes I know about Sys.os_type):

  • arch
  • system
  • distribution name
  • release

I found that in opam there is this module to get all those information. Is there a way to import this module in an OCaml project using something like the opam-lib package which is out of date (

I think you should be able to get it from the opam-state package.


I have a standalone osrelease package here that I’m using for some CI work, but it’s not released yet. Feel free to create an issue there with your usecase, or submit PRs.