Project

sys-uname

0.69
A long-lived project that still receives updates
The sys-uname library provides an interface for gathering information about your current platform. The library is named after the Unix 'uname' command but also works on MS Windows. Available information includes OS name, OS version, system name and so on. Additional information is available for certain platforms.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

~> 1.1
 Project Readme

Ruby

Description

A cross-platform Ruby interface for getting operating system information. The name comes from the Unix 'uname' command, but this library works on MS Windows as well.

Prerequisites

ffi 1.0 or later

Installation

gem install sys-uname

Adding the trusted cert

gem cert --add <(curl -Ls https://raw.githubusercontent.com/djberg96/sys-uname/main/certs/djberg96_pub.pem)

Synopsis

require 'sys/uname' # require 'sys-uname' works, too

# You now have Sys::Uname and Sys::Platform classes available.
 
# Get full information about your system
p Sys::Uname.uname

# Check individual platform details about your system
p Sys::Platform.linux? # => true
p Sys::Platform::ARCH  # => :x86_64

BSD flavors, including OS X

Users on BSD platforms get the extra Uname.model method.

HP-UX Notes

HP-UX users get the extra Uname.id_number method. This is actually a String, not a Fixnum, because that's how it's defined in the utsname struct.

MS Windows Notes

The C version for Windows has been completely scrapped in favor of an OLE plus WMI approach. It is pure Ruby. Please see the MSDN documentation for the Win32_OperatingSystem class for a complete list of what each of the UnameStruct members mean.

The Platform Class

This was added both as a nicer way to check simple information about your system, and as a replacement for the old 'Platform' gem which is no longer maintained.

Future Plans

I may dump the "Uname" portion of this library, and rename the project to just sys-platform.

Documentation

For more details, see the 'uname.rdoc' file under the 'doc' directory.