rails rbenv: rails: command not found

Boss Nass picture Boss Nass · Mar 28, 2015 · Viewed 20k times · Source

I have recently moved from RVM to Rbenv and when attempting to execute rails I am getting an error like the one below

Pauls-Air:~ $ rails
rbenv: rails: command not found

The `rails' command exists in these Ruby versions:
  2.1.2

Answer

Klaus picture Klaus · Mar 28, 2015

After installing a gem via the command line in a ruby version you have to execute rbenv rehash as described in the docs here and here

For example:

$ rbenv install 2.2.0
$ gem install bundler
$ rbenv rehash
$ gem install rails
$ rbenv rehash