RubySDK and gems in Rubymine does not match gem environment in terminal

In rubymine the gem paths shows as:

GEM PATHS:

   /Users/george/.rubies/ruby-1.9.3-p392/lib/ruby/gems/1.9.1

   /Users/george/.gem/ruby/1.9.1

Note that /Users/george/.gem/ruby/1.9.1 doe NOT exist. /Users/george/.rubies/ruby-1.9.3-p392/lib/ruby/gems/1.9.1 DOES exist but has next to nothing in it.

In the terminal it is:

- GEM PATHS:

     - /Users/george/.gem/ruby/1.9.3

     - /Users/george/.rubies/ruby-1.9.3-p392/lib/ruby/gems/1.9.1

/Users/george/.gem/ruby/1.9.3/gems DOES contain all the gems (installed by bundler from the command line)

I have recently switched from rvm to chruby and ruby-builder in case that has some bearing on the issue.

The rails server works fine from the command line and all gem commands etc are fine.

The server wont run from RubyMine as it cant find the gems as it is looking in the wrong place.

Under preferences "RubySDK and gems" I can change the ruby but you dont seem to be able to set the gem location....

Full environment details for RubyMine and Terminal below:

RUBYMINE

RUBYGEMS VERSION: 2.2.2

RUBY VERSION: 1.9.3 (2013-02-22 patchlevel 392) [x86_64-darwin12.5.0]

INSTALLATION DIRECTORY: /Users/george/.rubies/ruby-1.9.3-p392/lib/ruby/gems/1.9.1

RUBY EXECUTABLE: /Users/george/.rubies/ruby-1.9.3-p392/bin/ruby

EXECUTABLE DIRECTORY: /Users/george/.rubies/ruby-1.9.3-p392/bin

SPEC CACHE DIRECTORY: /Users/george/.gem/specs

RUBYGEMS PLATFORMS:

  ruby

  x86_64-darwin-12

GEM PATHS:

   /Users/george/.rubies/ruby-1.9.3-p392/lib/ruby/gems/1.9.1

   /Users/george/.gem/ruby/1.9.1

GEM CONFIGURATION:

   :update_sources => true

   :verbose => true

   :backtrace => false

   :bulk_threshold => 1000

REMOTE SOURCES:

   https://rubygems.org/

SHELL PATH:

   /Users/george/.rubies/ruby-1.9.3-p392/bin

   /usr/bin

   /bin

   /usr/sbin

   /sbin

   /usr/local/bin

   /Users/george/bin

   /opt/X11/bin

   /usr/local/bin

----------------------

IDE: RubyMine 6.0.3, build #RM-133.632

OS: Mac OS X 10.9.2[x86_64]

Java: 1.6.0_65-b14-462-11M4609

RubyMine SDK Environment:

Sdk: ruby-1.9.3-p392

Sdk Version: ver.1.9.3p392 ( revision 39386) p392

Ruby Interpreter: /Users/george/.rubies/ruby-1.9.3-p392/bin/ruby

RVM Sdk: no

RVM Home: /usr/local/rvm

Sdk Language Level: 1.9

Sdk Load Path:

     ~/.rubies/ruby-1.9.3-p392/lib/ruby/site_ruby/1.9.1

     ~/.rubies/ruby-1.9.3-p392/lib/ruby/site_ruby/1.9.1/x86_64-darwin12.5.0

     ~/.rubies/ruby-1.9.3-p392/lib/ruby/site_ruby

     ~/.rubies/ruby-1.9.3-p392/lib/ruby/vendor_ruby/1.9.1

     ~/.rubies/ruby-1.9.3-p392/lib/ruby/vendor_ruby/1.9.1/x86_64-darwin12.5.0

     ~/.rubies/ruby-1.9.3-p392/lib/ruby/vendor_ruby

     ~/.rubies/ruby-1.9.3-p392/lib/ruby/1.9.1

     ~/.rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/x86_64-darwin12.5.0

     /Applications/RubyMine.app/rubystubs193

Sdk Gem paths:

     ~/.rubies/ruby-1.9.3-p392/lib/ruby/gems/1.9.1/gems

     ~/.gem/ruby/1.9.1/gems

     ~/.rubies/ruby-1.9.3-p392/lib/ruby/gems/1.9.1/bundler/gems

     ~/.gem/ruby/1.9.1/bundler/gems


TERMINAL

RubyGems Environment:

  - RUBYGEMS VERSION: 2.2.2

  - RUBY VERSION: 1.9.3 (2013-02-22 patchlevel 392) [x86_64-darwin12.5.0]

  - INSTALLATION DIRECTORY: /Users/george/.gem/ruby/1.9.3

  - RUBY EXECUTABLE: /Users/george/.rubies/ruby-1.9.3-p392/bin/ruby

  - EXECUTABLE DIRECTORY: /Users/george/.gem/ruby/1.9.3/bin

  - SPEC CACHE DIRECTORY: /Users/george/.gem/specs

  - RUBYGEMS PLATFORMS:

    - ruby

    - x86_64-darwin-12

  - GEM PATHS:

     - /Users/george/.gem/ruby/1.9.3

     - /Users/george/.rubies/ruby-1.9.3-p392/lib/ruby/gems/1.9.1

  - GEM CONFIGURATION:

     - :update_sources => true

     - :verbose => true

     - :backtrace => false

     - :bulk_threshold => 1000

  - REMOTE SOURCES:

     - https://rubygems.org/

  - SHELL PATH:

     - /Users/george/.gem/ruby/1.9.3/bin

     - /Users/george/.rubies/ruby-1.9.3-p392/lib/ruby/gems/1.9.1/bin

     - /Users/george/.rubies/ruby-1.9.3-p392/bin

     - /usr/bin

     - /bin

     - /usr/sbin

     - /sbin

     - /usr/local/bin

     - /Users/george/bin

     - /opt/X11/bin




7 comments

Hi,

it looks like this is something specific to chruby (which we do not support yet - http://youtrack.jetbrains.com/issue/RUBY-14086).  
By default GEM_PATH points to ~/.gem/ruby/1.9.1, but chruby uses ~/.gem/ruby/1.9.3 for 1.9.3 and we are not ready for this :(

As a workaround I suggest to try to modify GEM_PATH for the project but it has to be done for every run configuration and still RubyMine will not see gems installed there :(

Regards, Oleg

0

Thanks for the reply Oleg.
You suggest modifying GEM_PATH for the project.

I cant see any way to change that in RubyMine that is the problem! I can only select the Ruby version and not the gem location/ GEM_PATH.

Or are you suggesting that I try to modify chruby?

0

Hi,

well while you can definitely patch chruby I can not recommend this :)
You could try to modify your run configurations to set GEM_PATH correctly and this (as I said) is a tedious work :(

Oleg.

P.S. another option is to not use chruby, but I suspect this is not an option for a person who has just moved to it

0

I found where you mean by setting the run configurations but it doesnt make any difference. It just says "No Rails found in SDK"

You said "It wont find the gems anyway".. So what is the point in setting the GEM_PATH in the run configuration?

0

Sorry, I didn't know that you work on a Rails project :(  For regular ruby project this could help, but for Rails (or if you decide to use rspec) it is no-use :(

I'm not sure there is a workaround for your problem expect switching to eith rvm or rbenv :(

Sorry for a bad news, Oleg.

0

I would like to know where Rubymine take the info for compile the RubyGems Environmen:

  • It parse the RubyGems Environment from the "gem env" command
  • It read the info from some other files


It's important to know because if Rubymine parse the "gem env" command this is Rubymine bug.
Instead if it reads some file we can try to modify that file.

0

Hi,

RubyMine doesn't use output of "gem env" and it needs to know more about the ruby version manager (such as rbenv, rvm, or chruby) to support it.
Thus it is not a bug but missed feature :(  We do not support chruby (yet).

Oleg.

0

Please sign in to leave a comment.