I started using rbenv to control ruby versions, and I found that irb is not loading the correct ruby version and gem version. Here are the details.
irb Gem.path says:
`>> Gem.path => ["/Users/Air/.gem/ruby/1.8", "/Library/Ruby/Gems/1.8", "/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8"]`
Now in irb, if I type: puts $:
`>> puts $: /Library/Ruby/Site/1.8 /Library/Ruby/Site/1.8/powerpc-darwin11.0 /Library/Ruby/Site/1.8/universal-darwin11.0 /Library/Ruby/Site /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/vendor_ruby/1.8 /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/vendor_ruby/1.8/universal-darwin11.0 /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/vendor_ruby /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8 /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/powerpc-darwin11.0 /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin11.0`
In the shell, I type: gem env
`RubyGems Environment: - RUBYGEMS VERSION: 1.8.10 - RUBY VERSION: 1.9.2 (2011-07-09 patchlevel 290) [x86_64-darwin11.0.1] - INSTALLATION DIRECTORY: /Users/Air/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1 - RUBY EXECUTABLE: /Users/Air/.rbenv/versions/1.9.2-p290/bin/ruby - EXECUTABLE DIRECTORY: /Users/Air/.rbenv/versions/1.9.2-p290/bin - RUBYGEMS PLATFORMS: - ruby - x86_64-darwin-11 - GEM PATHS: - /Users/Air/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1 - /Users/Air/.gem/ruby/1.9.1 - GEM CONFIGURATION: - :update_sources => true - :verbose => true - :benchmark => false - :backtrace => false - :bulk_threshold => 1000 - REMOTE SOURCES: - http:`
I see that irb is loading the wrong version of Ruby and loading the wrong Gem path . Can someone help to figure out how I can fix this. I use rbenv to control ruby versions, not sure how this plays into things. Advice?
source share