# Is there any way to fin 32 bit or 64 bit version?

**URL:** <https://www.ruby-forum.com/t/is-there-any-way-to-fin-32-bit-or-64-bit-version/185396>\
**Category:** Ruby\
**Created:** [March 19, 2010, 6:02am UTC](https://www.ruby-forum.com/t/is-there-any-way-to-fin-32-bit-or-64-bit-version/185396 "2010-03-19T06:02:05Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![martin\_mercy2001](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/d2c977/32.png) [@martin\_mercy2001](https://www.ruby-forum.com/u/martin_mercy2001)\
**Post date:** [March 19, 2010, 6:02am UTC](https://www.ruby-forum.com/t/is-there-any-way-to-fin-32-bit-or-64-bit-version/185396/1 "2010-03-19T06:02:05Z")

</div>

Dear friends,

Is there any way to find whether the installed ruby is of 32 bit version  
or 64 bit version.

Actually i have installed slackware 13 in 32 bit machine. What would be  
default ruby version in slackware 13 whether the ruby is for 32 bit  
machine or 64 bit machine?

Ruby -v shows : ruby 1.8.7 (2009-06-12 patchlevel 174) [i486-linux]

Please suggest me the default ruby that comes with slackware 13? whether  
its for 32 bit machine or 64 bit machine?

Thanks in advance

Regards,  
Jose MArtin

---

<div class="post-metadata">

**Author:** ![martin\_mercy2001](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/d2c977/32.png) [@martin\_mercy2001](https://www.ruby-forum.com/u/martin_mercy2001)\
**Post date:** [March 19, 2010, 7:25am UTC](https://www.ruby-forum.com/t/is-there-any-way-to-fin-32-bit-or-64-bit-version/185396/2 "2010-03-19T07:25:15Z")

</div>

> Actually i have installed slackware 13 in 32 bit machine. What would be  
> default ruby version in slackware 13 whether the ruby is for 32 bit  
> machine or 64 bit machine?
> 
> Ruby -v shows : ruby 1.8.7 (2009-06-12 patchlevel 174) [i486-linux]

[i486-linux] indicates this is a 32-bit version. A 64-bit version  
would say something like [amd64-linux] I believe.

-Jonathan N.

---

<div class="post-metadata">

**Author:** ![martin\_mercy2001](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/d2c977/32.png) [@martin\_mercy2001](https://www.ruby-forum.com/u/martin_mercy2001)\
**Post date:** [March 19, 2010, 8:16am UTC](https://www.ruby-forum.com/t/is-there-any-way-to-fin-32-bit-or-64-bit-version/185396/3 "2010-03-19T08:16:10Z")

</div>

On Mar 18, 11:02 pm, dare ruby [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Dear friends,
> 
> Is there any way to find whether the installed ruby is of 32 bit version  
> or 64 bit version.

-1.size \> 4 ? “64Bit” : “32Bit”

Regards,

Dan

---

<div class="post-metadata">

**Author:** ![martin\_mercy2001](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/d2c977/32.png) [@martin\_mercy2001](https://www.ruby-forum.com/u/martin_mercy2001)\
**Post date:** [March 19, 2010, 4:34pm UTC](https://www.ruby-forum.com/t/is-there-any-way-to-fin-32-bit-or-64-bit-version/185396/4 "2010-03-19T16:34:35Z")

</div>

On a 64-bit machine (Ubuntu Karmic):

$ ruby -v  
ruby 1.8.7 (2009-06-12 patchlevel 174) [x86\_64-linux]

> > Object.constants.map { |c| [c,Object.const\_get©] }.each { |c,v| p [c,v] if c=~/RUBY/ || v =~ /86/}; nil  
> > [“RUBY\_DESCRIPTION”, “ruby 1.8.7 (2009-06-12 patchlevel 174)  
> > [x86\_64-linux]”]  
> > [“RUBY\_PLATFORM”, “x86\_64-linux”]  
> > [“RUBY\_VERSION”, “1.8.7”]  
> > [“RUBY\_COPYRIGHT”, “ruby - Copyright © 1993-2009 Yukihiro M.”]  
> > [“RUBY\_PATCHLEVEL”, 174]  
> > [“PLATFORM”, “x86\_64-linux”]  
> > [“RUBY\_RELEASE\_DATE”, “2009-06-12”]

---

<div class="post-metadata">

**Author:** ![martin\_mercy2001](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/d2c977/32.png) [@martin\_mercy2001](https://www.ruby-forum.com/u/martin_mercy2001)\
**Post date:** [March 20, 2010, 6:38am UTC](https://www.ruby-forum.com/t/is-there-any-way-to-fin-32-bit-or-64-bit-version/185396/5 "2010-03-20T06:38:19Z")

</div>

2010/3/19 Daniel B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> On Mar 18, 11:02Â pm, dare ruby [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > Dear friends,
> > 
> > Is there any way to find whether the installed ruby is of 32 bit version  
> > or 64 bit version.
> 
> -1.size \> 4 ? “64Bit” : “32Bit”

That’s not true for MS Windows.

c:\work\ruby-1.9.1-p376\>ruby -ve ‘p(-1.size)’  
ruby 1.9.1p376 (2009-12-07 revision 26041) [x64-mswin64\_90]  
4

Try:  
[‘a’].pack(‘P’).length \> 4 ? “64Bit” : “32Bit”

Regards,

Park H.
