Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RubyMine error: Unable to run gem 'rails'. Cannot find 'rails'

When I try to create Rails Application with RubyMine, it fails with message "Unable to run gem 'rails'. Cannot find 'rails'". Why? And how to solve it?

RubyMine's version is 4.0.2.

There's some information about my system:

$ ruby -v
ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-linux]
$ gem -v
1.8.11
$ uname -a
Linux somehost 3.2.0-2-amd64 #1 SMP Tue Mar 20 18:36:37 UTC 2012 x86_64 GNU/Linux
$ lsb_release -d
Description:    Debian GNU/Linux testing (wheezy)
$ rails -v
Rails 3.2.3

Here's output of gem list --local: http://pastebin.com/CymzGUpf

RubyMine see the same set of gems: http://ompldr.org/vZGM2eA

Other IDEs for Ruby and Ruby on Rails (Eclipse with plugin DLTK-Ruby, Netbeans) work fine.

What do I do wrong?

like image 819
frp Avatar asked Apr 11 '12 12:04

frp


1 Answers

This problem is caused by ruby and rails executable files being located in different directories, normally they should be in the same directory and RubyMine is looking for the rails script in the same location where the configured ruby interpreter binary is.

In this particular case the locations were as follows:

  • /usr/local/bin/rails
  • /usr/bin/ruby

One of the solutions is to create a symlink of the rails script in the /usr/bin directory:

sudo ln -s /usr/local/bin/rails /usr/bin/rails

like image 123
CrazyCoder Avatar answered Nov 05 '22 14:11

CrazyCoder