https://github.com/rdp/os
The OS gem allows for some easy telling if you’re on windows or not. OS.windows? as well as some other helper utilities
https://github.com/rdp/os
Keywords from Contributors
activejob activerecord mvc rubygems rack test-coverage coverage-report coverage-library coverage code-quality
Last synced: about 8 hours ago
JSON representation
Repository metadata
The OS gem allows for some easy telling if you’re on windows or not. OS.windows? as well as some other helper utilities
- Host: GitHub
- URL: https://github.com/rdp/os
- Owner: rdp
- License: mit
- Created: 2009-12-17T00:20:20.000Z (over 16 years ago)
- Default Branch: master
- Last Pushed: 2025-07-22T01:13:32.000Z (10 months ago)
- Last Synced: 2026-05-22T12:11:41.655Z (2 days ago)
- Language: Ruby
- Size: 133 KB
- Stars: 154
- Watchers: 3
- Forks: 37
- Open Issues: 17
- Releases: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
README.md
The OS gem allows for some easy telling if you're on windows or not.
Install
bundle add os
Usage
require 'os'
>> OS.windows?
=> true # or OS.doze?
>> OS.bits
=> 32
>> OS.java?
=> true # if you're running in jruby. Also OS.jruby?
>> OS.ruby_bin
=> "c:\ruby18\bin\ruby.exe" # or "/usr/local/bin/ruby" or what not
>> OS.posix?
=> false # true for linux, os x, cygwin
>> OS.mac? # or OS.osx? or OS.x?
=> false
>> OS.dev_null
=> "NUL" # or "/dev/null" depending on which platform
>> OS.rss_bytes
=> 12300033 # number of rss bytes this process is using currently. Basically "total in memory footprint" (doesn't include RAM used by the process that's in swap/page file)
>> OS.host_cpu
=> "x86_64"
>> puts OS.report
==> # a yaml report of helpful values
---
arch: x86_64-darwin10.6.0
target_os: darwin10.6.0
target_vendor: apple
target_cpu: x86_64
target: x86_64-apple-darwin10.6.0
host_os: darwin10.6.0
host_vendor: apple
host_cpu: i386
host: i386-apple-darwin10.6.0
RUBY_PLATFORM: x86_64-darwin10.6.0
>> OS.cpu_count
=> 2 # number of cores, doesn't include hyper-threaded cores.
>> OS.open_file_command
=> "start" # or open on mac, or xdg-open on linux (all designed to open a file)
>> OS::Underlying.windows?
=> true # true for cygwin or MRI, whereas OS.windows? is false for cygwin
>> OS::Underlying.bsd?
=> true # true for OS X
>> OS::Underlying.docker?
=> false # true if running inside a Docker container
>> pp OS.parse_os_release
==> # A hash of details on the current Linux distro (or an exception if not Linux)
{:NAME=>"Ubuntu",
:VERSION=>"18.04.4 LTS (Bionic Beaver)",
:ID=>"ubuntu",
:ID_LIKE=>"debian",
:PRETTY_NAME=>"Ubuntu 18.04.4 LTS",
:VERSION_ID=>"18.04",
:HOME_URL=>"https://www.ubuntu.com/",
:SUPPORT_URL=>"https://help.ubuntu.com/",
:BUG_REPORT_URL=>"https://bugs.launchpad.net/ubuntu/",
:PRIVACY_POLICY_URL=>
"https://www.ubuntu.com/legal/terms-and-policies/privacy-policy",
:VERSION_CODENAME=>"bionic",
:UBUNTU_CODENAME=>"bionic"}
If there are any other features you'd like, let me know, I'll do what I can to add them :)
http://github.com/rdp/os for feedback et al
Alternatives
rubygems:
Gem::Platform.local
Gem.ruby
The reason Gem::Platform.local felt wrong to me is that it treated cygwin as windows--which for most build environments, is wrong. Hence the creation of this gem.
the facets gem (has a class similar to rubygems, above)
require 'facets/platform'
Platform.local
the "platform" gem, itself (a different gem)
FFI::Platform::OS
Contributing
Develop locally:
bundle install
bundle exec guard
License
License: MIT (see LICENSE file)
Owner metadata
- Name: Roger Pack
- Login: rdp
- Email:
- Kind: user
- Description: Quack!
- Website: www.betterlogic.com/roger
- Location: UT
- Twitter:
- Company: FamilySearch
- Icon url: https://avatars.githubusercontent.com/u/12496?v=4
- Repositories: 248
- Last ynced at: 2023-04-09T04:55:30.585Z
- Profile URL: https://github.com/rdp
GitHub Events
Total
- Pull request event: 9
- Fork event: 3
- Issues event: 2
- Watch event: 11
- Issue comment event: 10
- Push event: 3
- Pull request review event: 2
- Create event: 1
Last Year
- Pull request event: 5
- Issues event: 2
- Watch event: 7
- Issue comment event: 10
- Push event: 3
- Pull request review event: 2
- Create event: 1
Committers metadata
Last synced: about 9 hours ago
Total Commits: 153
Total Committers: 22
Avg Commits per committer: 6.955
Development Distribution Score (DDS): 0.412
Commits in past year: 0
Committers in past year: 0
Avg Commits per committer in past year: 0.0
Development Distribution Score (DDS) in past year: 0.0
| Name | Commits | |
|---|---|---|
| rogerdpack | r****5@g****m | 90 |
| Matt Scilipoti | m****t@s****e | 25 |
| Peter Boling | p****g@g****m | 9 |
| rogerdpack | r****k@g****m | 5 |
| Josef Šimánek | j****k@g****m | 4 |
| Brice Videau | b****u@i****r | 2 |
| Neil E. Pearson | n****l@p****y | 2 |
| Stefan Wrobel | s****l | 2 |
| Lisa Ugray | l****y@s****m | 1 |
| Roger Pack | r****m | 1 |
| wilkboar | w****r@b****m | 1 |
| Akira Matsuda | r****e@d****p | 1 |
| Charlie Jonas | c****e@c****k | 1 |
| Dorian Marié | d****n@d****r | 1 |
| Edward Betts | e****d@4****m | 1 |
| Jose Elera | j****a@g****m | 1 |
| Kyle Drake | k****e@k****t | 1 |
| Mike Perham | m****e@p****t | 1 |
| Taylor Braun-Jones | t****r@b****g | 1 |
| mishina | t****8@g****m | 1 |
| teitei-tk | t****k@g****m | 1 |
| İ. Emre Kutlu | e****u@g****m | 1 |
Committer domains:
- braun-jones.org: 1
- perham.net: 1
- kyledrake.net: 1
- 4angle.com: 1
- dorianmarie.fr: 1
- charliejonas.co.uk: 1
- dio.jp: 1
- box435.bluehost.com: 1
- shopify.com: 1
- pearson.sydney: 1
- imag.fr: 1
- scilipoti.name: 1
Issue and Pull Request metadata
Last synced: 11 days ago
Total issues: 40
Total pull requests: 47
Average time to close issues: about 1 year
Average time to close pull requests: 30 days
Total issue authors: 22
Total pull request authors: 24
Average comments per issue: 1.6
Average comments per pull request: 1.19
Merged pull request: 36
Bot issues: 0
Bot pull requests: 2
Past year issues: 0
Past year pull requests: 9
Past year average time to close issues: N/A
Past year average time to close pull requests: 2 months
Past year issue authors: 0
Past year pull request authors: 2
Past year average comments per issue: 0
Past year average comments per pull request: 0.89
Past year merged pull request: 4
Past year bot issues: 0
Past year bot pull requests: 1
Top Issue Authors
- pboling (12)
- rdp (6)
- mattscilipoti (2)
- MarkDBlackwell (2)
- mperham (1)
- emuesuenu (1)
- arohr (1)
- bigbgh (1)
- jaxn (1)
- AMaleh (1)
- koppor (1)
- ghost (1)
- tindron (1)
- ioquatix (1)
- jorgefuertes (1)
Top Pull Request Authors
- mattscilipoti (9)
- simi (8)
- pboling (6)
- swrobel (2)
- mperham (2)
- dependabot[bot] (2)
- jelera (1)
- teitei-tk (1)
- CHTJonas (1)
- AndyObtiva (1)
- nocnokneo (1)
- fugufish (1)
- emrekutlu (1)
- raw-cs (1)
- amatsuda (1)
Top Issue Labels
Top Pull Request Labels
- dependencies (2)
- ruby (1)
Package metadata
- Total packages: 12
-
Total downloads:
- rubygems: 874,885,935 total
- Total docker downloads: 1,298,263,672
- Total dependent packages: 261 (may contain duplicates)
- Total dependent repositories: 28,942 (may contain duplicates)
- Total versions: 66
- Total maintainers: 1
gem.coop: os
The OS gem allows for some useful and easy functions, like OS.windows? (=> true or false) OS.bits ( => 32 or 64) etc"
- Homepage: http://github.com/rdp/os
- Documentation: http://www.rubydoc.info/gems/os/
- Licenses: MIT
- Latest release: 1.1.4 (published over 4 years ago)
- Last Synced: 2026-05-22T17:01:05.752Z (2 days ago)
- Versions: 28
- Dependent Packages: 0
- Dependent Repositories: 0
- Downloads: 437,361,074 Total
- Docker Downloads: 649,131,836
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 0.019%
- Downloads: 0.058%
- Maintainers (1)
rubygems.org: os
The OS gem allows for some useful and easy functions, like OS.windows? (=> true or false) OS.bits ( => 32 or 64) etc"
- Homepage: http://github.com/rdp/os
- Documentation: http://www.rubydoc.info/gems/os/
- Licenses: MIT
- Latest release: 1.1.4 (published over 4 years ago)
- Last Synced: 2026-05-24T04:00:50.026Z (about 10 hours ago)
- Versions: 28
- Dependent Packages: 261
- Dependent Repositories: 28,942
- Downloads: 437,524,861 Total
- Docker Downloads: 649,131,836
-
Rankings:
- Downloads: 0.061%
- Dependent packages count: 0.155%
- Dependent repos count: 0.207%
- Docker downloads count: 0.222%
- Average: 1.702%
- Stargazers count: 4.685%
- Forks count: 4.882%
- Maintainers (1)
debian-11: ruby-os
- Homepage: http://github.com/rdp/os
- Documentation: https://packages.debian.org/bullseye/ruby-os
- Licenses:
- Latest release: 0.9.6-1.1 (published 3 months ago)
- Last Synced: 2026-03-14T05:21:58.137Z (2 months ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 100%
debian-10: ruby-os
- Homepage: http://github.com/rdp/os
- Documentation: https://packages.debian.org/buster/ruby-os
- Licenses:
- Latest release: 0.9.6-1 (published 3 months ago)
- Last Synced: 2026-03-14T03:01:40.450Z (2 months ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 100%
debian-12: ruby-os
- Homepage: http://github.com/rdp/os
- Documentation: https://packages.debian.org/bookworm/ruby-os
- Licenses:
- Latest release: 0.9.6-1.1 (published 3 months ago)
- Last Synced: 2026-03-13T04:21:17.809Z (2 months ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 100%
debian-13: ruby-os
- Homepage: http://github.com/rdp/os
- Documentation: https://packages.debian.org/trixie/ruby-os
- Licenses:
- Latest release: 0.9.6-1.1 (published 3 months ago)
- Last Synced: 2026-03-14T18:10:54.521Z (2 months ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 100%
Dependencies
- diff-lcs 1.1.3
- os 1.0.1
- power_assert 1.0.2
- rake 0.9.6
- test-unit 3.2.3
- actions/checkout v4 composite
- ruby/setup-ruby v1 composite
Score: 29.732163774714888