Search code examples
rubyrvmrubymine

Ruby Mine complains that "Cannot switch SDK." even if the SDK is there and available


My Ruby Mine 6.0.3 gives the message:

Project .ruby-version Settings: Cannot switch SDK. RVM SDK '2.1.1@rails3' wasn't found.

I manage ruby environments with rvm.
The wanted environment seems to be ok:

rvm gemset list

gemsets for ruby-2.1.1 (found in /home/agostino/.rvm/gems/ruby-2.1.1)
    (default)
    global
    rails3 
=>  testproject

Not only this, but also Mine seems to access the rvm environments quite well since opening File, Settings i can see:

Ruby Mine 6.03, File, Settings, Ruby SDK and Gems

So why can't it switch to the correct environment?

If, in the form above, I select it manually, it seems to work fine. But the "cannot switch..." message still appears each time I open the project.


Solution

  • I found for a similar problem (Rubymine 6.3.1 and Ruby 2.1.1) that I had to format .ruby-version in the following way:

    ruby-2.1.1
    

    Note the prefix 'ruby-" to the version number. I'm not sure whether this is an RVM, Ruby, Rubymine, or some other issue that caused this problem, but the fix I mentioned worked on my Mac.