From: Eric Hodel Date: 2009-08-19T04:14:26+09:00 Subject: Re: gem installation oddity On Aug 18, 2009, at 11:47, Pito Salas wrote: > Eric Hodel wrote: > I don't think I exactly followed this. But in the meanwhile I think I > have figured out what was tripping me up. The sample apps that come > with > wxruby begin with a line that looks like this: > > #!/usr/bin/env ruby > # wxRuby2 Sample Code. Copyright (c) 2004-2008 wxRuby development team > # Freely reusable code: see SAMPLES-LICENSE.TXT for details > > Which, the way I was running it, led it to look at the ruby that comes > with OSX rather than the one I have designated as primary, which is > actually in /opt/local/... Designate /opt/local/ruby as your primary ruby by setting your PATH, then /usr/bin/env can work as designed. > My gem install is going into the primary ruby > install so when the sample app runs, it's not finding it. So removing > that first line makes the thing work. > It still doesn't explain to me why this is happening, but it might be, > as the first response said, a bug in "gem which". It's a bit > worrysome, > but for the moment it's not holding me up: > > $ sudo gem install wxruby > Successfully installed wxruby-2.0.0-universal-darwin-9 > 1 gem installed > Installing ri documentation for wxruby-2.0.0-universal-darwin-9... > Installing RDoc documentation for wxruby-2.0.0-universal-darwin-9... > $ gem which wxruby > Can't find ruby library file or shared library wxruby > $ I told you that wxruby doesn't exist already. You can use gem contents -l as in my previous mail to see which files are in a gem to make a guess at what to use. Of course, you should go read the documentation first if you can't immediately figure out how to use the gem. > By the way, you asked: > >> Is there even a wxruby in the gem? > > The code doesn't look for it; here's what it looks like: > > #!/usr/bin/env ruby > # wxRuby2 Sample Code. Copyright (c) 2004-2008 wxRuby development team > # Freely reusable code: see SAMPLES-LICENSE.TXT for details > begin > require 'rubygems' > rescue LoadError > end > require 'wx' Why are you still trying to require a file that doesn't exist (wxruby) and that the documentation says doesn't exist (linked-to from my previous mail)? The documentation tells you which file to require. You even found a file that uses the wxruby gem and you're still looking for the wrong file... Not every gem name has a 1:1 mapping to the file you need to require. When require name_of_gem doesn't work, you can use the various tools from my previous email to find the file you need to require. Of course the first spot you should check is the documentation for the gem you're using.