From: Walton Hoops Date: 2010-01-16T01:40:37+09:00 Subject: Re: How to know the OS architecture (32 or 64 bits)? On 1/15/2010 9:36 AM, Walton Hoops wrote: > On 1/14/2010 4:12 PM, I単aki Baz Castillo wrote: >> Hi, is there a reliable way under Ruby to know the OS architecture >> (32 or 64 >> bits)? >> >> I've just found RUBY_PLATFORM constant which returns "x86_64-linux" >> under 64 >> bits, however it doesn't send very reliable for me. >> >> I need a way working under Linux and BSD. Thanks for any suggestion. >> > > I can't vouch for how accurate it is, but an OS gem was recently > announced on this list. > gem install os > > irb(main):001:0> require 'os' > => true > irb(main):002:0> OS.bits > => 64 > irb(main):004:0> OS.posix? > => true > irb(main):005:0> > > Hmm.. it does not appear to deal with 32-bit ruby running on a 64 bit system though. On my Windows 7 x64 (with 32-bit ruby): irb(main):005:0> OS.bits => 32 irb(main):006:0> 1.size => 4 irb(main):007:0>