# Â€œarch -i386 rubyâ€ not loading into 32-bit mode in 10.6.3

**URL:** <https://www.ruby-forum.com/t/a-oearch-i386-rubya-not-loading-into-32-bit-mode-in-10-6-3/186209>\
**Category:** Ruby\
**Created:** [April 2, 2010, 5:31am UTC](https://www.ruby-forum.com/t/a-oearch-i386-rubya-not-loading-into-32-bit-mode-in-10-6-3/186209 "2010-04-02T05:31:24Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![richardfairhurst](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/c37758/32.png) [@richardfairhurst](https://www.ruby-forum.com/u/richardfairhurst)\
**Post date:** [April 2, 2010, 5:31am UTC](https://www.ruby-forum.com/t/a-oearch-i386-rubya-not-loading-into-32-bit-mode-in-10-6-3/186209/1 "2010-04-02T05:31:24Z")

</div>

\<2.33GHz MBPC2D running OS X 10.6.3\>

OSAX calls within the default 64-bit environment of OS X 10.6.3 (I have  
not tried with earlier OS X versions) are failing when using what has  
been recommended for forcing Ruby to run in 32-bit mode: â€œ#! arch -i386  
rubyâ€.

A test script, results, and software versions are appended below.

Thoughts?

Thanks!!

Richard F.

---- Script ----

#! arch -i386 ruby  
require ‘rubygems’  
require ‘appscript’; include Appscript  
require ‘osax’; include OSAX  
p scripting\_additions  
#=\> [“Digital Hub Scripting”, “Numerics”, “Satimage”,  
“SpeedDownloadLoader”, “StandardAdditions”, “XMLLib”]

# so good so far and non-OSAX scripts run as expected, but

# none of the following work:

osax.beep  
osax.set\_the\_clipboard\_to(“howdy”)  
osax.say (“Hey, wake up.”, :using=\>“Victoria”)

---- Results ----

RuntimeError: OSAX::ScriptingAddition can’t dynamically retrieve  
scripting addition terminology within a 64-bit process.  
from /Library/Ruby/Site/1.8/osax.rb:153:in `initialize' from /Library/Ruby/Site/1.8/osax.rb:102:in`new’  
from /Library/Ruby/Site/1.8/osax.rb:102:in `osax' from /Library/Ruby/Site/1.8/osax.rb:124:in`osax’  
from (irb):4

---- Software Versions ----

ruby 1.8.7 (2009-06-08 patchlevel 173) [universal-darwin10.0]  
RubyGems 1.3.6  
StandardAdditions.osax version 2.1.2

# To determine whether Ruby is running in 32bit or 64bit

[‘foo’].pack(‘p’).size #=\> 8 on 64bit, 4 on 32bit, I got â€œ8â€

---

<div class="post-metadata">

**Author:** ![richardfairhurst](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/c37758/32.png) [@richardfairhurst](https://www.ruby-forum.com/u/richardfairhurst)\
**Post date:** [April 3, 2010, 12:58am UTC](https://www.ruby-forum.com/t/a-oearch-i386-rubya-not-loading-into-32-bit-mode-in-10-6-3/186209/2 "2010-04-03T00:58:19Z")

</div>

Richard F. wrote:

> \<2.33GHz MBPC2D running OS X 10.6.3\>
> 
> OSAX calls within the default 64-bit environment of OS X 10.6.3 (I have  
> not tried with earlier OS X versions) are failing when using what has  
> been recommended for forcing Ruby to run in 32-bit mode: â€œ#! arch -i386  
> rubyâ€.

Not clear how you ran it, but it sounds as if you’re still running in  
64-bit mode.

To test the script, I changed the hashbang to ‘#!/usr/bin/env -i386  
ruby’, saved it as ‘test.rb’, chmodded it to make it executable, and ran  
it as ./test.rb, and it ran fine in 32-bit.

FWIW, I have a TODO on embedding Standard Additions terminology in the  
OSAX module (I’ve already done this for py-appscript) so that it will  
work on 64-bit as well. I still need to figure out Ruby 1.9’s text  
encoding support before I do a new release though.

HTH

## has

Control AppleScriptable applications from Python, Ruby and ObjC:  
[http://appscript.sourceforge.net](http://appscript.sourceforge.net)

---

<div class="post-metadata">

**Author:** ![richardfairhurst](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/c37758/32.png) [@richardfairhurst](https://www.ruby-forum.com/u/richardfairhurst)\
**Post date:** [April 3, 2010, 1:49am UTC](https://www.ruby-forum.com/t/a-oearch-i386-rubya-not-loading-into-32-bit-mode-in-10-6-3/186209/3 "2010-04-03T01:49:45Z")

</div>

> Not clear how you ran it, but it sounds as if you’re still running in  
> 64-bit mode.

Iâ€™ve been entering it manually into Terminal and also running it as an  
AppleScript:

do shell script “ruby ‘/Applications/ Scripting/Ruby/Tests/test.rb’”

The results are the same in either case (as in initial post), only the  
OSAX calls fail.

AFAICT, it is still in 64-bit mode. Early on I ran the following with  
the noted result:

# To determine whether Ruby is running in 32bit or 64bit

[‘foo’].pack(‘p’).size #=\> 8 on 64bit, 4 on 32bit #=\> I got â€œ8â€

> To test the script, I changed the hashbang to ‘#!/usr/bin/env -i386  
> ruby’,

I tried that as an initial attempt and it didnâ€™t work either.

> chmodded it to make it executable,

I didnâ€™t know that was necessary as other scripts ran fine, only the  
OSAX calls failed. Please offer some wisdom as to how to set it as such,  
if it is necessary!

> and ran it as ./test.rb, and it ran fine in 32-bit.

I would love to be able to get the same results; at least I now know it  
is possible in 10.6.3! Any other advice would be greatly appreciated! (I  
love AppleScript. Really. I do. 😉 )

> FWIW, I have a TODO on embedding Standard Additions terminology in the  
> OSAX module (I’ve already done this for py-appscript) so that it will  
> work on 64-bit as well. I still need to figure out Ruby 1.9’s text  
> encoding support before I do a new release though.

If you would like (yet another) beta-tester, just let me know!

😉

Thanks for your incredible efforts! Appscript is quite a blessing!

Richard F.

---

<div class="post-metadata">

**Author:** ![richardfairhurst](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/c37758/32.png) [@richardfairhurst](https://www.ruby-forum.com/u/richardfairhurst)\
**Post date:** [April 3, 2010, 11:59am UTC](https://www.ruby-forum.com/t/a-oearch-i386-rubya-not-loading-into-32-bit-mode-in-10-6-3/186209/4 "2010-04-03T11:59:08Z")

</div>

Richard F. wrote:

> > Not clear how you ran it, but it sounds as if you’re still running in  
> > 64-bit mode.
> 
> Iâ€™ve been entering it manually into Terminal and also running it as an  
> AppleScript:
> 
> do shell script “ruby ‘/Applications/ Scripting/Ruby/Tests/test.rb’”

The hashbang at the top of a script only applies when you execute the  
script file directly. Since you’re invoking the ruby interpreter  
yourself and passing the script path as an argument, it will be ignored.

Use:

do shell script “arch -i386 ruby ‘/Applications/  
Scripting/Ruby/Tests/test.rb’”

> > FWIW, I have a TODO on embedding Standard Additions terminology in the  
> > OSAX module (I’ve already done this for py-appscript) so that it will  
> > work on 64-bit as well. I still need to figure out Ruby 1.9’s text  
> > encoding support before I do a new release though.
> 
> If you would like (yet another) beta-tester, just let me know!

It’s in the subversion repository if you want to play with it.

HTH

has
