Search code examples
ruby-on-railsrubyunixrvm

Rails bundle - bad interpreter


I've been working on a rails project in sublime text and switched to rubymine. It said that some gems, which are required in the project, are not installed. Well, I tried to install them, but it fails with an error saying that the used ruby version is another than the version specified in the gem file.

When I enter ruby -v, it looked like the same version. I've then tried to reinstall the ruby version (2.0.0) and as that didn't lead to success, I've installed 2.1.0 hoping it would set the correct path and everything.

When I now try to enter bundle, I get the following error:

bash: /Users/user/.rvm/gems/ruby-2.0.0-p353/bin/bundle: /Users/user/.rvm/rubies/ruby-2.1.0/bin/ruby: bad interpreter: No such file or directory

Version 2.1.0 is not even installed anymore. I've searched for solutions for a long time but nothing really worked in my case. How would you fix this error? As far as I understand I understand the problem and the answers I've read, some kind of link to a path, used by the bundle command, is set wrong?

I'm using rvm for ruby the versions.

ruby -v says `ruby 2.0.0p353 (2013-11-22 revision 43784) [x86_64-darwin12.5.0]

rvm listsays

   ruby-1.9.2-p320 [ x86_64 ]
   ruby-1.9.3-p0 [ x86_64 ]
   ruby-1.9.3-p392 [ x86_64 ]
   ruby-1.9.3-p448 [ x86_64 ]
   ruby-2.0.0-p0 [ x86_64 ]
   ruby-2.0.0-p247 [ x86_64 ]
=* ruby-2.0.0-p353 [ x86_64 ]

Solution

  • You should run:

    gem install bundler

    after reinstalling ruby and point of note, your version of ruby should be same as that in the Gemfile