-1

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

Andrew Marshall
  • 95,083
  • 20
  • 220
  • 214
Ben
  • 25,389
  • 34
  • 109
  • 165

4 Answers4

1

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

Travis Pessetto
  • 3,260
  • 4
  • 27
  • 55
  • I believe to check you can use ```echo $PATH```. If you need to added it but, don't know where it is, try to find it ```find / -name ruby```. If you find it you can added it like so ```export PATH=$PATH:/path/to/ruby``` – Travis Pessetto Jun 14 '12 at 22:04
  • 2
    Also, did you follow the instructions after installing RVM to add it to all open shells? You can also try ```rvm use 1.9.3``` and retry your installs. – Travis Pessetto Jun 14 '12 at 22:06
  • @TravisPessetto Though I suspect that he's getting the correct `ruby` since his `ruby --version` is 1.9.3, but it definitely seems RVM was not correctly installed. – Andrew Marshall Jun 14 '12 at 22:24
1

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

Theo Scholiadis
  • 2,316
  • 2
  • 22
  • 33
1

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

Community
  • 1
  • 1
mpapis
  • 52,729
  • 14
  • 121
  • 158
  • Thanks, I am doing:rvm use 1.9.3-p125 -> get error: RVM is not a function, selecting rubies with 'rvm use ...' will not work. – Ben Jun 15 '12 at 13:13
  • make sure you update RVM(`rvm get stable --auto`), it will then give you more meaningful messages, just read them and follow the instructions. – mpapis Jun 15 '12 at 16:38
0

Try which rails in terminal to know the path.

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

Fernando Á.
  • 7,295
  • 7
  • 30
  • 32