[wxruby-users] OS X Snow Leopard + wxRuby 2.0.1 gem - WORKING

Ridge McGhee
2010-12-22T06:28:08Z

Some good news...

Alex, your method didn''t work for me immediately but I found a method
that works for me and may help others.

I have a MacBook Pro (64-bit) running OS X 10.6.
Like others, I wanted to run Ruby 1.9.2 (latest) and wxRuby 2.0.1
(latest).

I use RVM to install Ruby 1.9.2 (and manage my ruby versions).
(See http://pragmaticstudio.com/blog/2010/9/23/install-rails-ruby-mac)

By default, RVM builds the Ruby 64-bit version (only).
I finally found a post that indicates how to build both 32-bit and
64-bit versions of Ruby.

Briefly, here''s how to get both built:
rvm install ruby-1.9.2-head -C --with-arch=x86_64,i386

Here''s how to check what you have:
file `which ruby` | perl -pe ''s|^.*/||''

(Which will produce output like this:)
ruby: Mach-O universal binary with 2 architectures
ruby (for architecture x86_64): Mach-O 64-bit executable x86_64
ruby (for architecture i386):   Mach-O executable i386

Visit:
http://rubyforge.org/frs/?group_id=35

And, download this gem:
wxruby-ruby19-2.0.1-x86-darwin-9.gem

Now, install the gem (no sudo required):
(Note, you may want to cd to your Downloads folder.)
gem install wxruby-ruby19-2.0.1-x86-darwin-9.gem
Successfully installed wxruby-ruby19-2.0.1-x86-darwin-9

Create a wxruby test script (wxtest.rb):
------------------------------------
#!/usr/bin/env arch -i386 ruby

require ''wx''
include Wx

App.run do
  frame = Frame.new(nil, :title => ''So far, so good...'')
  frame.show
end
------------------------------------

And run it:
> ruby wxtest.rb


Ok, so this particular working set produced a window.
So, we (or I anyway) have a way to proceed.

Alex - I hope this somehow helps you find out what the problem
(32-bit vs 64-bit) might be.  Any thoughts?

Cheers,
Ridge


Alex Fenton wrote in post #923756:
> Hi
>
> It is possible to use the standard wxRuby 2.0.1 gem with the standard
> system ruby in /usr/bin/ruby in OS X 10.6
>
> 1) download the gem
>
>
http://rubyforge.org/frs/download.php/63386/wxruby-2.0.1-universal-darwin-9.gem
>
> 2) install it from the downloaded file
>
> sudo gem install wxruby-2.0.1-universal-darwin-9.gem
>
> 3) run ruby like this, forcing 32-bit mode
>
> arch -i386 ruby -rubygems <scriptfile.rb>
>
>
> Have tested with a couple of samples and this works fine. Appreciate any
> feedback. Of course, we are still aiming to get full compatibility, but
> for various reasons this is quite difficult.
>
> Thanks to some advice on this page (comment #4)
> http://weblog.rubyonrails.org/2009/8/30/upgrading-to-snow-leopard
>
> alex