not success to get rails --version from ubuntu 11.04 console

I have Ubuntu 11.04, + Ruby 1.9.3-p125

I have installed Rails in 2 ways:

  • rvm gem install rails

  • gem install rails

When I want to check the version of Rails I'm using:

rails --version

I get the error:

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

Answers


Make sure that the RVM ruby version is in your PATH.


If you have just installed rvm, then even though you have not installed rails, you are not "using" a gemset. If you run rvm gemset list you will notice a list of gemsets (probably just 'global'), with no star next to any of them.

You first need to use a gemset before you can see what version a gem is in that gemset. Try something like rvm use @global to use the 'global' gemset. Then you will see something on your terminal like Using /home/john/.rvm/gems/ruby-1.9.3-p125 with gemset global. Now if you try doing rails -v It should give you your version number

Hope this helps


you need to use ruby before doing any work with it:

rvm use 1.9.3-p125

now you can just run any commands without prefixing them with rvm:

gem install rails
rails new test1

when you did prefix command with rvm it was actually short for:

rvm all do gem install rails

which means install gem rails into all rubies @default gemset.

you could be also victim of old and broken RVM installation bundled with Ubuntu, have a look on this answer for details: https://stackoverflow.com/a/9056395/497756

Also you should get known with some details how to use RVM, you should find this short tutorial very resourceful: http://screencasts.org/episodes/how-to-use-rvm


Try which rails in terminal to know the path.

It should be /usr/bin/rails. If not try export PATH=/usr/bin:$PATH.


Need Your Help

How do I export and import application services with say MEF?

c# dependency-injection mef

I'm working with MEF right now, but the answer I'm looking for probably is irrelevant to MEF -- it's all dependency injection -- I'm just using MEF terminology as an example here.