Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

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.

like image 522
AgostinoX Avatar asked Apr 19 '14 15:04

AgostinoX


2 Answers

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.

like image 88
BigGillyStyle Avatar answered Sep 19 '22 15:09

BigGillyStyle


I am not sure if this is the case, but you might be telling rubymine to use a different ruby version, and it uses that version on all the commands, that's why it shows the errors on each interaction with ruby.

You need to change the running configuration, from the menu choose: Run > Edit configuration

Then you'll find few settings on the left, choose the one that you use to run your project, and on the right check for Ruby SDK, choose the correct ruby version from the list, and click ok. Every thing should be fine, you might need to bundle because gems aren't shared between different ruby versions.

like image 43
Mohammad AbuShady Avatar answered Sep 19 '22 15:09

Mohammad AbuShady