Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I had installed rubygems 1.8 and further on I had installed the rails 2.0.2 gem.

When I tried to view the rails version installed through the command rails -v

It didn't work.. I am unable to figure out why I am getting an "invalid option" on executing the command rails -v ( Please refer the below for the same).

mohnish@mohnish-laptop:~/Downloads$ ruby -v
ruby 1.8.7 (2010-01-10 patchlevel 249) [i486-linux]
mohnish@mohnish-laptop:~/Downloads$ gem list

*** LOCAL GEMS ***

actionmailer (2.0.2)
actionpack (2.0.2)
activerecord (2.0.2)
activeresource (2.0.2)
activesupport (2.0.2)
rails (2.0.2)
rake (0.8.7)
mohnish@mohnish-laptop:~/Downloads$ rails -v
getopt: invalid option -- 'v'

Could you please help me out on this regard..

Please note I am currently not making use of the ruby version manager(rvm). Please let me know if I could get a solution once I install the rvm.

Thanks for your help..

share|improve this question
I find that most of my headaches go away when I use RVM. good luck with the package manager. >< – Derek Jan 8 '11 at 18:01
What happens if you enter which rails? – pdr Jan 8 '11 at 19:09
@pdr: I get: "/usr/bin/rails" on typing the command "which rails" – boddhisattva Jan 9 '11 at 2:15

You can just install the rails package install rails.

$ ruby -v
ruby 1.8.7 (2010-06-23 patchlevel 299) [i686-linux]
$ rails -v
Rails 2.3.5

Your version numbers will be a bit lower than mine because I am using Ubuntu 10.10.

share|improve this answer
I tried out the link... It says that you have a rails package already installed. – boddhisattva Jan 9 '11 at 2:17
Some wise person has said never to install the Rails package from the Ubuntu repo. – Zabba Jan 9 '11 at 10:16
@mgj - that's strange. You could try sudo apt-get remove rails then sudo gem uninstall rails then sudo apt-get install rails to revert to the repository version only. @Zabba - that 'wise' person was wrong. You should always use repository packages unless there is a good reason not to, like you need a specific version that isn't packages. – dv3500ea Jan 9 '11 at 10:40
Thanks for your suggestion, I would consider that option as a last resort. I am trying to figure another way out in the mean time. – boddhisattva Jan 12 '11 at 6:06

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.