RubyGems error in Rails console

If I open a rails console I see the following error message

Rails requires RubyGems >= 1.3.1 (you have 1.0.1). Please `gem update --system` and try again.

Is this a problem I should be concerned about?

I'm running on Mac OSX. I have removed the default SDK and added Ruby SDK 1.8.7 /usr/local/bin/

which gem gives

/usr/local/bin/gem

which ruby gives
/usr/local/bin/ruby




Gem environment gives

RubyGems Environment:
  - RUBYGEMS VERSION: 1.3.3
  - RUBY VERSION: 1.8.7 (2008-08-11 patchlevel 72) [i686-darwin9.6.2]
  - INSTALLATION DIRECTORY: /usr/local/lib/ruby/gems/1.8
  - RUBY EXECUTABLE: /usr/local/bin/ruby
  - EXECUTABLE DIRECTORY: /usr/local/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86-darwin-9
  - GEM PATHS:
     - /usr/local/lib/ruby/gems/1.8
     - /Users/greg/.gem/ruby/1.8
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false

     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - http://gems.rubyforge.org/


2 comments
Comment actions Permalink

Hello Greg,

This is due to bug in rails.


MacOS doesn't apply environment variables from ~/.profile to all applications(only for Terminal.app) thus RM uses default PATH. I've noticed that rails invokes rails console using irb scrip

# rails-2.3.2/lib/commands/console.rb

irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb'
...
opt.on("--irb=[#{irb}]", 'Invoke a different irb.') { |v| options[:irb] = v }
...
exec "#{options[:irb]} #{libs} --simple-prompt"



Thus in your case rails invokes irb command using RubyMine's PATH env.variable : "/usr/bin/irb". You can fix this in 3 ways:
1. In rails-xxx/lib/commands/console.rb replace first line with correct one


irb = File.join(Config::CONFIG['bindir'],
                RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb')




I'm going to submit this change as fix to rails project (issue #2625 - https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/2625)

2. Fix /usr/bin/irb to point on /opt/local/bin/irb
3. Fix PATH for RubyMine.app using ~/.MacOSX/environment.plist

P.S:  In next RM build we will use --irb and ask rails console to use irb from correct Ruby SDK ( http://www.jetbrains.net/jira/browse/RUBY-4007)

0
Comment actions Permalink

Thanks for the prompt help. I went for option 1 and it worked a treat, once I'd found the command.rb here


  /Users/greg/.gem/ruby/1.8/gems/rails-2.2.2/lib/commands


Greg


0

Please sign in to leave a comment.