From: Walton Hoops Date: 2010-01-16T04:56:24+09:00 Subject: Re: How to know the OS architecture (32 or 64 bits)? On 1/15/2010 9:59 AM, I単aki Baz Castillo wrote: > El Viernes, 15 de Enero de 2010, I単aki Baz Castillo escribi坦: > > >> Note that to know the bits it uses "rbconfig" gem, and them: >> > Well, "rbconfig" is not a gem but a Ruby built in library. > > > > >> In my server RbConfig::CONFIG['host_os'] = "linux-gnu" so finally it ends >> doing: >> >> if (1<<32).class == Fixnum >> 64 >> else >> 32 >> end >> >> Which is basically the same as doing >> >> if 1.size == 8 >> 64 >> else >> 32 >> end >> >> > > Definitively I don't like "os" gem at all. It could use > RbConfig::CONFIG['host_cpu'] rather than the not reliable > RbConfig::CONFIG['host_os']: > > > a) 32 bits host: > > RbConfig::CONFIG['host_os'] => "linux-gnu" > RbConfig::CONFIG['host_cpu'] => "i486" > > b) 64 bits host: > > RbConfig::CONFIG['host_os'] => "linux-gnu" > RbConfig::CONFIG['host_cpu'] => "x86_64" > > > submit a bug! http://github.com/rdp/os My main concern with that though: Would RbConfig::CONFIG['host_cpu'] return "x86_64" if I'm running 32-bit Linux on a 64-bit CPU?