Dave Nicolette
Dave Nicolette

Reputation: 181

bundle install does not run within RubyMine

Using RubyMine 2017.3.1 on Mac OSX 10.13.3, when I choose "Tools -> Bundler -> install" and set optional arguments "--path vendor/bundle", the result is

/usr/bin/ruby -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) install --path vendor/bundle
-e:1:in `load': cannot load such file -- install (LoadError)
    from -e:1:in `<main>'

The command "bundle install --path vendor/bundle" works when executed on the command line.

It also works when defined under "External Tools" as a command-line command.

I've been unable to find a way to correct the generated command line in RubyMine, or to correct the problem in some other way.

How can I set up RubyMine to execute bundler correctly?

Upvotes: 4

Views: 2689

Answers (1)

Jeff Sheffel
Jeff Sheffel

Reputation: 181

I was able to solve this same issue. The root cause was that I had configured RubyMine (apparently to use /usr/bin/ruby), then subsequently installed rvm to manage my Ruby versions and thence changed/upgraded the Ruby version (associated with the source code directory, by using rvm). I also successfully ran bundle from the command line. Yet, RubyMine was still configured to use the original Ruby binary (/usr/bin/ruby), and so, running bundle from within RubyMine was failing (with the cannot load error).

The fix was to set RubyMine to use the same/newer rvm version of Ruby, by updating the settings in Preferences->Ruby SDK and Gems menu. Refer to the attached screenshot. Now, the RubyMine bundle install command successfully works by running the matching Ruby instance (i.e. ~/.rvm/rubies/ruby-2.3.5/bin/ruby).

RubyMine Preferences->RubySDKandGems screenshot

Upvotes: 3

Related Questions