问题
I've made a custom sient installer of Ruby 2.0 with some gems and extras, my installer expands all the Ruby files to c:\Program Files (x86)\Ruby, the interpreter (ruby.exe) is in the Bin folder, all is as normally but just it's not an original installation, I expand the files and I add the registry keys to associate files by my own, I can run Ruby as normally ever I want.
Now, is the first time that I try the JetBrains RubyMine IDE, and I can't found a simple guide which explains how to set the Ruby directory, seems that this IDE assumes that the Ruby installation is original and maybe takes a registry value from the original Ruby installer to know the Path or something, I don't know, but just I didn't see any help about how to set the Ruby directory manually.
(I have the same problem for PyCharm)
Anyways I've tried to set it from the Ruby SDK and Gems option, the dialog-box says "select Ruby interpreter Path", but I'm on the Path and it's not recognized, I mean that the Ok button still disabled:
Then I'm missing the right option anywhere? or really a professional and expensive IDE like this doesn't has support just to specify the location of Ruby in these circunstance where an user does not use the original Ruby installer? I really will think not.
回答1:
In my experience it is more preferable to set your PATH environment variables appropriately instead of trying to locate executables on a per-app basis.
You can set your path so that the desired Ruby takes precedence over any other rubies and I am sure that RubyMine will pick it up (or just use ruby and let your PATH specify which to use).
On another note you might also want to have a look at a ruby version manager such as rbenv or RVM.
Update: Just tried to set manually a Ruby SDK in the latest version of RubyMine (6.3) and it worked as expected. I had, however, to expand the folder in which the binary resided (in your case bin
), select the actual binary and then click OK. Have you tried that as well?
回答2:
If you have two JRuby versions installed and one of them is not recognized:
- Add both bin directories to your
PATH
(like in Kostas Rousis's answer above), - set
JRUBY_HOME
to the one version you want to use and - restart RubyMine.
In my case, I have the version 1.6.8 and 9.1.13.0 installed. Setting JRUBY_HOME
to the newer version I can use both versions. However setting JRUBY_HOME
to the older version, RubyMine only recognises the older version, even when I navigate to the newer version's folder. That's a really weird behavior but I'll take it. I still remember that it worked properly in earlier versions of RubyMine though (I'm currently at 2017.2.4).
来源:https://stackoverflow.com/questions/23125024/rubymine-doesnt-recognize-my-ruby-installation-path