I'm a bit at the end of my wits here. I'm on OSX10.6 and my gems are all screwed up. One of the gems I'm trying to use is Hashie. I've looked around on the internet and several people seem to be having similar problems but I none of their solutions seem to work in my case. Thanks for looking.
All my ruby scripts / gems are installed in /opt/ruby-enterprise-1.8.7-2010.02:
Komputor:~$ which ruby gem irb rails
/opt/ruby-enterprise-1.8.7-2010.02/bin/ruby
/opt/ruby-enterprise-1.8.7-2010.02/bin/gem
/opt/ruby-enterprise-1.8.7-2010.02/bin/irb
/opt/ruby-enterprise-1.8.7-2010.02/bin/rails
And the example gem, hashie (and many others) are installed:
Komputor:~ $ gem list -l | wc -l
67
Komputor:~ $ gem list | grep hashie
hashie (0.4.0)
Komputor:gems $ cd /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems
Komputor:gems $ ls | grep hashie
drwxr-xr-x 13 root admin 442 Nov 24 17:13 hashie-0.4.0
Yet when I try to access them from irb or a script, it all fails:
Komputor:~ $ irb
irb(main):001:0> require 'hashie'
LoadError: no such file to load -- hashie
from (irb):1:in `require'
from (irb):1
irb(main):002:0>
Some environment variables: Gem env:
Komputor:gems $ gem env
RubyGems Environment:
- RUBYGEMS VERSION: 1.3.7
- RUBY VERSION: 1.8.7 (2010-04-19 patchlevel 253) [i686-darwin10.4.0]
- INSTALLATION DIRECTORY: /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8
- RUBY EXECUTABLE: /opt/ruby-enterprise-1.8.7-2010.02/bin/ruby
- EXECUTABLE DIRECTORY: /opt/ruby-enterprise-1.8.7-2010.02/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86-darwin-10
- GEM PATHS:
- /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8
- /Users/<snip>/.gem/ruby/1.8
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- http://rubygems.org/
$PATH:
Komputor:gems $ echo $PATH
/sw/bin:/sw/sbin:/opt/ruby-enterprise-1.8.7-2010.02/bin:/Applications/android-sdk-1.5/tools:/usr/brlcad/bin:/usr/local/mysql-5.0.67-osx10.5-x86_64/bin:/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/local/mongodb/bin:/sw/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/usr/X11/bin:/usr/X11R6/bin
I'll be happy to post up the output of any commands for debugging.
Thanks for looking!
As Adam Vandenberg points out, before loading a gem you need to require "rubygems"
Some frameworks may load this for you, and you can set it to autoload in your .irbrc
if you like
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With