From: Pito Salas Date: 2009-08-19T04:39:18+09:00 Subject: Re: gem installation oddity Eric Hodel wrote: > On Aug 18, 2009, at 11:47, Pito Salas wrote: >> 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. I think that's how I have it: $ echo $PATH /opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin ~$ echo $GEMPATH /opt/local/lib/ruby/gems/1.8/ ~$ > >> 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. > >> $ 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. > >> 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... Hm, I thought I was requiring wx.rb which in does exist. I agree that wxruby does not exist. Am I missing it totally? However, your reply has helped me also uncover another misunderstanding, which may be what you were trying to say all along, that is that: $gem which 'xxx' looks for a file called xxx.rb in a gem, rather than a gem called xxx. That's why my $gem which wxruby Keeps saying that it can't find it, but now I tried $gem which wx and that succeeds. > > 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. Yeah, that's a key bit of the puzzle that I hadn't understood. Thanks! -- Posted via http://www.ruby-forum.com/.