ruby version manager (rvm) with RubyMine 2.0

What is the correct way of using ruby version manager (rvm) ( ) with RubyMine 2.0 and Mac OS X 10.5.x?

What about with Mac OS X 10.6.x?

Can I use Preferences --> Ruby SDK and Gems --> and then Add SDK?

Or do I need to invoke RubyMine 2.0 from the command line?

Or do I need to do something like this:  ?

Comment actions Permalink

You can simply open your project and RubyMine should pick all your sdk's installed via RVM automatically. If it doesn't work, feel free to file a bug report (please describe rvm version, installation directory and installed ruby interpreters) and add sdk manually with add sdk button.

Comment actions Permalink

What was missing from the instructions was where to find the SDK.

I am answering my own question.

To find the SDKs when using rvm do:

$rvm list
   ruby-1.8.6-p383 [ i386 ]
=> ruby-1.8.7-p248 [ i386 ]
   ruby-1.9.1-p376 [ i386 ]
   system [ ppc i386 ]

$ which ruby

In RubyMine 2.0 go to RubyMine --> Preferences
Project settings
Ruby SDK and Gems
Ruby interpreter
(Click on the 6th icon which is "Show hidden files and directories")
Put in the path to ruby
Click Apply and OK

One can then choose different Ruby SDK in the individual run configurations.

Here is my test file cf2.rb

require 'rbconfig'
celsius = 100
fahrenheit = (celsius * 9 / 5) + 32
puts "The result is: #{fahrenheit}."
for i in ["bindir","rubylibdir","archdir","sitedir","vendordir"]
puts "#{i} is #{Config::CONFIG[i]}"
puts "load path"
puts $:

When the program is run should see something like this:

/Users/oserj/.rvm/ruby-1.8.7-p248/bin/ruby -e STDOUT.sync=true;STDERR.sync=true;load($0=ARGV.shift) /Users/oserj/src/sfruby/c2f.rb
The result is: 212.
bindir is /Users/oserj/.rvm/ruby-1.8.7-p248/bin
rubylibdir is /Users/oserj/.rvm/ruby-1.8.7-p248/lib/ruby/1.8
archdir is /Users/oserj/.rvm/ruby-1.8.7-p248/lib/ruby/1.8/i686-darwin9.7.0
sitedir is /Users/oserj/.rvm/ruby-1.8.7-p248/lib/ruby/site_ruby
vendordir is /Users/oserj/.rvm/ruby-1.8.7-p248/lib/ruby/vendor_ruby

load path

Process finished with exit code 0

Comment actions Permalink

RubyMine should automatically detect rvm SDKs using (~/.rvm information) and you needn't add SDK manually using "add sdk" button. If you add new sdk to rvm you should just relaunch RubyMine. If your RubyMine's behaviour differs from this than it is some RubyMine bug and we should fix it.

Comment actions Permalink

Hi Roman,

I just did an install of RubyMine 2.0 and 2.0.1 along with a fresh rvm 0.999 (which is the latest) When I go to the RubyMine preferences there are no entries in the SDK dropdown. If I understand your comment. I should file a bug report? Was I supposed to do anything else to populate/add the sdk's?


Comment actions Permalink

I'm having the same problem on Rubymine 2.0.1. It doesnt recognize RVM in the dropdown.

If I select the RVM location manually (~/.rvm/rubies/...../bin),  it works. However, it fails whenever trying to install native gems. Works fine when I install them from command line.

Please help

Comment actions Permalink

I've filed an issue - Our rvm support was implemented for some early version of rvm with different files layout in ~/.rvm directory. We are going to fix our rvm support in coming 2.0.2 version.

P.S: I've just fixed rvm support and tried to install native ruby-debug-ide19 gem in ruby19 rvm-based sdk. It seems all works fine!

Comment actions Permalink

I'm running into similar issues when trying to add a Ruby SDK in IDEA 9.0 (Ultimate) or RubyMine 2.0.1. Neither one is aware of rvm and worse I can't add interpreters located in ~/.rvm. Both simply always uses /usr/bin/ruby, no matter which path I enter in the Select Path dialog.


Please sign in to leave a comment.