Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

rails rbenv: rails: command not found

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 
like image 393
Boss Nass Avatar asked Mar 28 '15 11:03

Boss Nass


People also ask

How do I know if Rbenv is installed?

You can see if it is using rbenv by typing which ruby and it should print something out with . rbenv/ whatever. If not you need to set rbenv as your current ruby. You can do that like rbenv global 2.1.

Where is Rbenv installed?

If rbenv is run as the root user then it will be installed to /usr/local/rbenv, otherwise it will be installed to the users ~/. rbenv directory. To make rbenv available in the shell you may need to add the rbenv/shims and rbenv/bin directories to the users PATH.

What is Rbenv command?

rbenv is included in all installations of Bitnami Ruby stack that use system packages. It is a command-line tool which allows you to easily install, manage, and work with multiple Ruby environments. Every installed Ruby interpreter using rbenv is isolated in its own directory with its libraries and gems.

What is Rbenv install?

rbenv is a tool that lets you install and run multiple versions of Ruby side-by-side. It's a simple, lightweight alternative to RVM that focuses solely on managing multiple Ruby environments. Each version of Ruby is installed in the ~/. rbenv/versions directory.


1 Answers

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 
like image 105
Klaus Avatar answered Oct 09 '22 21:10

Klaus