ruby version manager (rvm) with RubyMine 2.0

What is the correct way of using ruby version manager (rvm) ( http://rvm.beginrescueend.com/ ) 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:
http://www.jetbrains.net/devnet/docs/DOC-1160  ?

7 comments

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.

0

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
/Users/oserj/.rvm/ruby-1.8.7-p248/bin/ruby


In RubyMine 2.0 go to RubyMine --> Preferences
Project settings
Ruby SDK and Gems
Ruby interpreter
Add SDK
(Click on the 6th icon which is "Show hidden files and directories")
Put in the path to ruby
/Users/oserj/.rvm/ruby-1.8.7-p248/bin/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]}"
end
puts
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
/Users/oserj/.rvm/ruby-1.8.7-p248/lib/ruby/site_ruby/1.8
/Users/oserj/.rvm/ruby-1.8.7-p248/lib/ruby/site_ruby/1.8/i686-darwin9.7.0
/Users/oserj/.rvm/ruby-1.8.7-p248/lib/ruby/site_ruby
/Users/oserj/.rvm/ruby-1.8.7-p248/lib/ruby/vendor_ruby/1.8
/Users/oserj/.rvm/ruby-1.8.7-p248/lib/ruby/vendor_ruby/1.8/i686-darwin9.7.0
/Users/oserj/.rvm/ruby-1.8.7-p248/lib/ruby/vendor_ruby
/Users/oserj/.rvm/ruby-1.8.7-p248/lib/ruby/1.8
/Users/oserj/.rvm/ruby-1.8.7-p248/lib/ruby/1.8/i686-darwin9.7.0
.

Process finished with exit code 0

0

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.

0

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?

-Joe

0

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

0

I've filed an issue - http://youtrack.jetbrains.net/issue/RUBY-5750. 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!

0

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.

0

Please sign in to leave a comment.