Question

I followed this guide to install Ruby on Centos 6.5 with Mod Passenger and Apache. But after running the command: # curl -L https://get.rvm.io | bash -s stable --ruby and then running ruby -v in the console, I got this message

-bash: ruby: command not found

what am I doing wrong? Can any one share a good guide or tutorial to get this working? I need to create a ROR application to start programming on this.

Was it helpful?

Solution

Just do /bin/bash --login to load it to bash shell.

Then run rvm list known to see what all ruby versions are available for download. You could see,

$ rvm list known
# MRI Rubies
[ruby-]1.8.6[-p420]
[ruby-]1.8.7[-p374]
[ruby-]1.9.1[-p431]
[ruby-]1.9.2[-p320]
[ruby-]1.9.3[-p545]
[ruby-]2.0.0-p353
[ruby-]2.0.0[-p451]
[ruby-]2.1.1
[ruby-]2.1-head
ruby-head

After that just install the ruby version you need using rvm command. E.g.,

rvm install ruby-2.1.1

After having installed multiple ruby versions, run command rvm list to see what all ruby versions are installed,

$ rvm list

rvm rubies

   ruby-1.8.7-p371 [ x86_64 ]
   ruby-1.9.3-p429 [ x86_64 ]
   ruby-2.0.0-p195 [ x86_64 ]
   ruby-2.0.0-p247 [ x86_64 ]
   ruby-2.1.0 [ x86_64 ]
   ruby-2.1.1 [ x86_64 ]

# => - current
# =* - current && default
#  * - default

Then using the command rvm use to use a particular ruby version for a particular project (from inside the project directory only). E.g.,

rvm use ruby-2.1.1

If you want it as the default version (May be you are running most of the ruby projects in ruby-2.1.1 version only), just use the below command,

rvm use ruby-2.1.1 --default

After all that just see the rvm list, you could see the versions currently in use and selected by default. Both can also be the same ruby version.

$ rvm list

rvm rubies

   ruby-1.8.7-p371 [ x86_64 ]
   ruby-1.9.3-p429 [ x86_64 ]
   ruby-2.0.0-p195 [ x86_64 ]
   ruby-2.0.0-p247 [ x86_64 ]
   ruby-2.1.0 [ x86_64 ]
=* ruby-2.1.1 [ x86_64 ]

# => - current
# =* - current && default
#  * - default

Then, just run ruby -v, you can see the ruby version selected for the project as,

ruby 2.1.1

run the command rvm help to know about more commands.

Hope it helps :)

OTHER TIPS

RVM is just a Ruby version manager. It isn't actually Ruby itself. Once you have installed RVM, you need to install some actual Ruby version (e.g. rvm install 2.1).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top