# Cannot load wxruby in IRB

**URL:** <https://www.ruby-forum.com/t/cannot-load-wxruby-in-irb/191184>\
**Category:** wxRuby\
**Created:** [July 7, 2010, 8:39am UTC](https://www.ruby-forum.com/t/cannot-load-wxruby-in-irb/191184 "2010-07-07T08:39:56Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![zengr](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/ecae2f/32.png) [@zengr](https://www.ruby-forum.com/u/zengr)\
**Post date:** [July 7, 2010, 8:39am UTC](https://www.ruby-forum.com/t/cannot-load-wxruby-in-irb/191184/1 "2010-07-07T08:39:56Z")

</div>

Hi,

I am new to ruby and trying to make a simple desktop app using wxruby.

When I do: require ‘wx’ I get this error:

irb(main):001:0\> require ‘wx’  
LoadError:  
dlopen(/usr/local/lib/ruby/gems/1.9.1/gems/wxruby-1.9.3-universal-darwin/lib/wxruby2.bundle,  
9): no suitable image found. Did find:  
/usr/local/lib/ruby/gems/1.9.1/gems/wxruby-1.9.3-universal-darwin/lib/wxruby2.bundle:  
no matching architecture in universal wrapper -  
/usr/local/lib/ruby/gems/1.9.1/gems/wxruby-1.9.3-universal-darwin/lib/wxruby2.bundle  
from  
/usr/local/lib/ruby/gems/1.9.1/gems/wxruby-1.9.3-universal-darwin/lib/wx.rb:12:in  
`require' from /usr/local/lib/ruby/gems/1.9.1/gems/wxruby-1.9.3-universal-darwin/lib/wx.rb:12:in`\<top (required)\>’  
from (irb):1:in `require' from (irb):1 from /usr/local/bin/irb:12:in`’

Any suggestions?

Thanks

---

<div class="post-metadata">

**Author:** ![zengr](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/ecae2f/32.png) [@zengr](https://www.ruby-forum.com/u/zengr)\
**Post date:** [July 7, 2010, 10:46am UTC](https://www.ruby-forum.com/t/cannot-load-wxruby-in-irb/191184/2 "2010-07-07T10:46:17Z")

</div>

Hi

On 07/07/2010 07:39, Utkarsh Sengar wrote:

> I am new to ruby and trying to make a simple desktop app using wxruby.

Welcome.

> When I do: require ‘wx’ I get this error:

Unfortunately, you can’t use wx interactively in irb. A gui app depends  
on entering an ‘event loop’ where it waits for the user to do something.  
This will just hang in irb.

> irb(main):001:0\> require ‘wx’  
> LoadError:  
> dlopen(/usr/local/lib/ruby/gems/1.9.1/gems/wxruby-1.9.3-universal-darwin/lib/wxruby2.bundle,

What OS X version are you on? 1.9.3 is a very old version, the current  
release is 2.0.1. You may be on Snow Leopard (10.6) in which case you’ll  
need to look in the recent m.l. archives for a user-contributed gem -  
unfortunately I haven’t got the trunk stable to build on this version  
yet.

alex

---

<div class="post-metadata">

**Author:** ![zengr](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/ecae2f/32.png) [@zengr](https://www.ruby-forum.com/u/zengr)\
**Post date:** [July 7, 2010, 11:19am UTC](https://www.ruby-forum.com/t/cannot-load-wxruby-in-irb/191184/3 "2010-07-07T11:19:03Z")

</div>

Thanks for the info Alex.

I am running Mac OS X 10.6. I dug up the archives and got the 2.0.1 for  
10.6 here: [Static gem of wxruby 2.0.1 for OS X Snow Leopard - wxRuby - Ruby-Forum](http://www.ruby-forum.com/topic/199011#905045)

I installed the gem:

sudo gem install wxruby-2.0.1-universal-darwin-10.gem

Regarding “require ‘wx’” in irb, I was just testing if I will be able to  
use wx in my ruby code or not. I guess, ONLY “require ‘wx’” should give  
me a -\>true right?

So, after installing 2.0.1 and doing a “require ‘wx’”, i got this error:

## irb(main):001:0\> require ‘wx’ LoadError: dlopen(/usr/local/lib/ruby/gems/1.9.1/gems/wxruby-2.0.1-universal-darwin-10/lib/wxruby2.bundle, 9): Symbol not found: \__ZN10wxCheckBox13MacControlHitEPvS0_ Referenced from: /usr/local/lib/ruby/gems/1.9.1/gems/wxruby-2.0.1-universal-darwin-10/lib/wxruby2.bundle Expected in: flat namespace

/usr/local/lib/ruby/gems/1.9.1/gems/wxruby-2.0.1-universal-darwin-10/lib/wxruby2.bundle  
from  
/usr/local/lib/ruby/gems/1.9.1/gems/wxruby-2.0.1-universal-darwin-10/lib/wx.rb:12:in  
`require' from /usr/local/lib/ruby/gems/1.9.1/gems/wxruby-2.0.1-universal-darwin-10/lib/wx.rb:12:in `\<top (required)\>’  
from (irb):1:in `require' from (irb):1 from /usr/local/bin/irb:12:in `’

I get the same error if i do a “require ‘wx’” in a .rb file and try to  
run it.

Thanks 🙂

Alex F. wrote:

> Hi
> 
> On 07/07/2010 07:39, Utkarsh Sengar wrote:
> 
> > I am new to ruby and trying to make a simple desktop app using wxruby.
> 
> Welcome.
> 
> > When I do: require ‘wx’ I get this error:
> 
> Unfortunately, you can’t use wx interactively in irb. A gui app depends  
> on entering an ‘event loop’ where it waits for the user to do something.  
> This will just hang in irb.
> 
> > irb(main):001:0\> require ‘wx’  
> > LoadError:  
> > dlopen(/usr/local/lib/ruby/gems/1.9.1/gems/wxruby-1.9.3-universal-darwin/lib/wxruby2.bundle,
> 
> What OS X version are you on? 1.9.3 is a very old version, the current  
> release is 2.0.1. You may be on Snow Leopard (10.6) in which case you’ll  
> need to look in the recent m.l. archives for a user-contributed gem -  
> unfortunately I haven’t got the trunk stable to build on this version  
> yet.
> 
> alex

---

<div class="post-metadata">

**Author:** ![zengr](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/ecae2f/32.png) [@zengr](https://www.ruby-forum.com/u/zengr)\
**Post date:** [July 8, 2010, 7:34am UTC](https://www.ruby-forum.com/t/cannot-load-wxruby-in-irb/191184/4 "2010-07-08T07:34:24Z")

</div>

Hi Alex,

I checked my ruby version and it was:

ruby 1.9.1p0 (2009-01-20 revision 21700) [i386-darwin10.4.0]

I followed your directions here: [OS X Snow Leopard + wxRuby 2.0.1 gem - WORKING - wxRuby - Ruby-Forum](http://www.ruby-forum.com/topic/212707)  
but it didn’t work.

Any suggestions?

Thanks

Alex F. wrote:

> On 07/07/2010 10:19, Mr zengr wrote:
> 
> > use wx in my ruby code or not. I guess, ONLY “require ‘wx’” should give  
> > me a -\>true right?
> 
> Yes. Although ultimately it would be nice to be able to test a GUI  
> design interactively.
> 
> > So, after installing 2.0.1 and doing a “require ‘wx’”, i got this error:
> > 
> > irb(main):001:0\> require ‘wx’  
> > LoadError:  
> > dlopen(/usr/local/lib/ruby/gems/1.9.1/gems/wxruby-2.0.1-universal-darwin-10/lib/wxruby2.bundle,  
> > 9): Symbol not found: \__ZN10wxCheckBox13MacControlHitEPvS0_
> 
> Sorry, I can’t provide support for this gem - I didn’t build it.
> 
> You may be a bit stuck for getting wxRuby working with the system ruby  
> provided in 10.6. Apple has made things difficult by moving to 64-bit  
> architecture, since Carbon (that provides much of wxWidgets 2.8 GUI) is  
> 32-bit only.
> 
> I’m using 10.6 and for wxRuby applications I’m using my own 32-bit build  
> of Ruby 1.9.1. This works just fine with the gems that are downloadable  
> from Rubyforge. Alternatively I can use the 2.0.1 build by using the  
> arch command - see following post.
> 
> alex

---

<div class="post-metadata">

**Author:** ![zengr](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/ecae2f/32.png) [@zengr](https://www.ruby-forum.com/u/zengr)\
**Post date:** [July 7, 2010, 11:40am UTC](https://www.ruby-forum.com/t/cannot-load-wxruby-in-irb/191184/5 "2010-07-07T11:40:44Z")

</div>

On 07/07/2010 10:19, Mr zengr wrote:

> use wx in my ruby code or not. I guess, ONLY “require ‘wx’” should give  
> me a -\>true right?

Yes. Although ultimately it would be nice to be able to test a GUI  
design interactively.

> So, after installing 2.0.1 and doing a “require ‘wx’”, i got this error:
> 
> irb(main):001:0\> require ‘wx’  
> LoadError:  
> dlopen(/usr/local/lib/ruby/gems/1.9.1/gems/wxruby-2.0.1-universal-darwin-10/lib/wxruby2.bundle,  
> 9): Symbol not found: \__ZN10wxCheckBox13MacControlHitEPvS0_

Sorry, I can’t provide support for this gem - I didn’t build it.

You may be a bit stuck for getting wxRuby working with the system ruby  
provided in 10.6. Apple has made things difficult by moving to 64-bit  
architecture, since Carbon (that provides much of wxWidgets 2.8 GUI) is  
32-bit only.

I’m using 10.6 and for wxRuby applications I’m using my own 32-bit build  
of Ruby 1.9.1. This works just fine with the gems that are downloadable  
from Rubyforge. Alternatively I can use the 2.0.1 build by using the  
arch command - see following post.

alex

---

<div class="post-metadata">

**Author:** ![zengr](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/ecae2f/32.png) [@zengr](https://www.ruby-forum.com/u/zengr)\
**Post date:** [July 8, 2010, 10:10am UTC](https://www.ruby-forum.com/t/cannot-load-wxruby-in-irb/191184/6 "2010-07-08T10:10:08Z")

</div>

On 08/07/2010 06:34, Mr zengr wrote:

> ruby 1.9.1p0 (2009-01-20 revision 21700) [i386-darwin10.4.0]
> 
> I followed your directions here: [OS X Snow Leopard + wxRuby 2.0.1 gem - WORKING - wxRuby - Ruby-Forum](http://www.ruby-forum.com/topic/212707)  
> but it didn’t work.

What happened?

---

<div class="post-metadata">

**Author:** ![zengr](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/ecae2f/32.png) [@zengr](https://www.ruby-forum.com/u/zengr)\
**Post date:** [July 8, 2010, 10:23am UTC](https://www.ruby-forum.com/t/cannot-load-wxruby-in-irb/191184/7 "2010-07-08T10:23:40Z")

</div>

Alex F. wrote:

> On 08/07/2010 06:34, Mr zengr wrote:
> 
> > ruby 1.9.1p0 (2009-01-20 revision 21700) [i386-darwin10.4.0]
> > 
> > I followed your directions here: [OS X Snow Leopard + wxRuby 2.0.1 gem - WORKING - wxRuby - Ruby-Forum](http://www.ruby-forum.com/topic/212707)  
> > but it didn’t work.
> 
> What happened?

I am sorry for not detailing the error, when I ran this:

arch -i386 ruby -rubygems ruby-file.rb

I got this error “arch: posix\_spawnp: ruby: Bad CPU type in executable”

So, did “uname -m” in my terminal and got i386. So, it seems I am in the  
32bit kernel mode. That’s why “ruby --version” also returned  
i386-darwin10.4.0.

So, to summarize:

1. I am running 32bit ruby 1.9.1 on Mac OS X 10.6 Snow Leopard
2. I manually installed wxruby (2.0.1 universal-darwin-9)
3. When I do “require ‘wx’” I get this error:

/usr/local/lib/ruby/gems/1.9.1/gems/wxruby-2.0.1-universal-darwin-9/lib/wx.rb:12:in  
`require': dlopen(/usr/local/lib/ruby/gems/1.9.1/gems/wxruby-2.0.1-universal-darwin-9/lib/wxruby2.bundle, 9): no suitable image found. Did find: (LoadError) /usr/local/lib/ruby/gems/1.9.1/gems/wxruby-2.0.1-universal-darwin-9/lib/wxruby2.bundle: no matching architecture in universal wrapper - /usr/local/lib/ruby/gems/1.9.1/gems/wxruby-2.0.1-universal-darwin-9/lib/wxruby2.bundle from /usr/local/lib/ruby/gems/1.9.1/gems/wxruby-2.0.1-universal-darwin-9/lib/wx.rb:12:in `\<top (required)\>’  
from ruby-file.rb:1:in `require' from ruby-file.rb:1:in `’

Thanks a lot for your help!

---

<div class="post-metadata">

**Author:** ![zengr](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/ecae2f/32.png) [@zengr](https://www.ruby-forum.com/u/zengr)\
**Post date:** [July 8, 2010, 11:29am UTC](https://www.ruby-forum.com/t/cannot-load-wxruby-in-irb/191184/8 "2010-07-08T11:29:12Z")

</div>

On 08/07/2010 09:23, Mr zengr wrote:

> 1. I am running 32bit ruby 1.9.1 on Mac OS X 10.6 Snow Leopard

In that case, there should be no problem - just use the standard gem for  
Ruby 1.9:

[http://rubyforge.org/frs/download.php/63385/wxruby-ruby19-2.0.1-x86-darwin-9.gem](http://rubyforge.org/frs/download.php/63385/wxruby-ruby19-2.0.1-x86-darwin-9.gem)

You shouldn’t need to mess around with ‘arch’ b/c both the executable  
and gem are simple 32-bit (actually, the gem is dual intel/ppc)

> 1. I manually installed wxruby (2.0.1 universal-darwin-9)

Sounds like you may have installed the gem for Ruby 1.8 by mistake?

---

<div class="post-metadata">

**Author:** ![zengr](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/ecae2f/32.png) [@zengr](https://www.ruby-forum.com/u/zengr)\
**Post date:** [July 9, 2010, 1:44pm UTC](https://www.ruby-forum.com/t/cannot-load-wxruby-in-irb/191184/9 "2010-07-09T13:44:32Z")

</div>

On 09/07/2010 03:31, Mr zengr wrote:

> /usr/local/lib/ruby/gems/1.9.1/gems/wxruby-ruby19-2.0.1-x86-darwin-9/lib/wxruby2.bundle:  
> no matching architecture in universal wrapper -

Hmm - did you compile your Ruby 1.9 under OS X 10.6? This may be the  
mismatch. My ruby 1.9 (which works with the gem) is a version I compiled  
before upgrading. There may be some compile flags for Ruby 1.9 to force  
arch and 10.5 compatibility. But I don’t know what they are.

Can you use Ruby 1.8? If so, the 10.6 system ruby in /usr/bin/ruby  
should work with the 1.8 gem, using arch.

> I am sorry for my never ending problems, I think i will shift to my  
> Ubuntu VM.

No problem - I blame Apple! Each platform has its own annoyances,  
though.

alex

---

<div class="post-metadata">

**Author:** ![zengr](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/ecae2f/32.png) [@zengr](https://www.ruby-forum.com/u/zengr)\
**Post date:** [July 9, 2010, 4:31am UTC](https://www.ruby-forum.com/t/cannot-load-wxruby-in-irb/191184/10 "2010-07-09T04:31:27Z")

</div>

Alex F. wrote:

> On 08/07/2010 09:23, Mr zengr wrote:
> 
> > 1. I am running 32bit ruby 1.9.1 on Mac OS X 10.6 Snow Leopard
> 
> In that case, there should be no problem - just use the standard gem for  
> Ruby 1.9:
> 
> [http://rubyforge.org/frs/download.php/63385/wxruby-ruby19-2.0.1-x86-darwin-9.gem](http://rubyforge.org/frs/download.php/63385/wxruby-ruby19-2.0.1-x86-darwin-9.gem)

I installed this gem and get the same error when I run this  
([http://wxruby.rubyforge.org/wiki/wiki.pl?Getting\_Started](http://wxruby.rubyforge.org/wiki/wiki.pl?Getting_Started)) sample code  
by:

$ ruby sample.rb

/usr/local/lib/ruby/gems/1.9.1/gems/wxruby-ruby19-2.0.1-x86-darwin-9/lib/wx.rb:12:in  
`require': dlopen(/usr/local/lib/ruby/gems/1.9.1/gems/wxruby-ruby19-2.0.1-x86-darwin-9/lib/wxruby2.bundle, 9): no suitable image found. Did find: (LoadError) /usr/local/lib/ruby/gems/1.9.1/gems/wxruby-ruby19-2.0.1-x86-darwin-9/lib/wxruby2.bundle: no matching architecture in universal wrapper - /usr/local/lib/ruby/gems/1.9.1/gems/wxruby-ruby19-2.0.1-x86-darwin-9/lib/wxruby2.bundle from /usr/local/lib/ruby/gems/1.9.1/gems/wxruby-ruby19-2.0.1-x86-darwin-9/lib/wx.rb:12:in `\<top (required)\>’  
from ruby-file.rb:1:in `require' from ruby-file.rb:1:in `’

> You shouldn’t need to mess around with ‘arch’ b/c both the executable  
> and gem are simple 32-bit (actually, the gem is dual intel/ppc)
> 
> > 1. I manually installed wxruby (2.0.1 universal-darwin-9)
> 
> Sounds like you may have installed the gem for Ruby 1.8 by mistake?

I am sorry for my never ending problems, I think i will shift to my  
Ubuntu VM.

Thanks
