views:

803

answers:

6

Hey there,

I'm using Ubuntu 9.10 Karmic Koala and Ruby 1.9.1.

I installed Rails using sudo gem install rails, which installed all the libraries for me.

When I type rails in the terminal it says.

The program 'rails' is currently not installed. You can install it by typing: sudo apt-get install rails rails: command not found

I can find rake, which is under rake1.9.1, but Rails is nowhere to be found, can someone point me in the right direction?

Edit: path to ruby isn't the problem, the problem is where is rails? how do I execute it? rails just doesn't work, where does the exectuable lives?

+1  A: 

Did you update your PATH variable to include the bin directory of the rails install?

MarkPowell
no.. I didn't, where should I point to? I cannot find its executable.locate rails returns just links of documentation.
rgoytacaz
A: 

You may want to include the path of Ruby/Jruby folder in your bashrc file. That would ensure that you are able to run it from anywhere. Don't forget to restart terminal or "source .bashrc" to reload variables in terminals.

Priyank
The problem isnt with ruby, ruby works great. But when running rails it says its not installed, although if I do gem list, it will properly show to me, rails 2.3.5
rgoytacaz
I looked up the bin folder of my ruby installation. It has a "rails" file. If i rename that to anything else and try to run rails; it doesn't scaffold or create projects..instead says that rails is not installed do sudo apt-get install to install rails.But if I rename it back to rails; then it starts working. So I am pretty sure that as long as rails is installed properly and you have it in bin folder it should run.Maybe I haven't installed it as a gem plus I am using JRuby.
Priyank
+1  A: 

As others say, this may very well be a PATH variable issue on your bashrc/bash_profile file.

You can learn how to change PATH..

You can get the current PATH variable by typing echo $PATH

TK
it isnt a problem of putting the path there, it seems rails it not installed at all, how do I check if its really installed? whats its executable? where does it lives?
rgoytacaz
Run `gem environment` and you'll find `EXECUTABLE DIRECTORY`.
TK
You ARE GREAT! THANKS TK! Thats exactly what I needed.It turns out that installing it through gem doesnt create a symlink. I created it and points it to the executable directory. working great
rgoytacaz
A: 

Should I install Rails using apt-get? Installed using gem and it didn't create the executable in the bin folder.

But it did for rake =/

rgoytacaz
A: 

gem should have placed the rails executable script in the same location as ruby's. I'd look in there and make sure the permissions are set correctly and it is executable.

Michael Wales
A: 

Just had the same issue just put the following in your .bashrc

PATH="${PATH}:/var/lib/gems/1.8/bin/
JaapH