Installed Rails but the rails command says it's not installed

Question!

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?

By : rgoytacaz


Answers

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.

By : Priyank


A possible solution is to not maintain two different configuration files .bash_profile and .bashrc

It's suggested in this excellent post on the difference between .bash_profile and .bashrc is to source .bashrc from your .bash_profile file, then putting PATH and common settings in .bashrc.

Quoting,

add the following lines to .bash_profile:

if [ -f ~/.bashrc ]; then source ~/.bashrc fi

end quote

By : osehgol


If you are using rbenv don't forget add

eval "$(rbenv init -)"

into your .bash_profile or other start up scripts. run rbenv rehash is also needed.



This video can help you solving your question :)
By: admin