mottalrd
mottalrd

Reputation: 4490

Cannot run rails from command line with rvm installation

I have just made a fresh install of rvm with rails on a fresh Linux Mint machine
I can see that rails is installed in my gems

gem query --local

*** LOCAL GEMS ***

...other stuff ...
rails (3.2.8)
...other stuff ...

but if I try to run from console I cannot see it

$ rails -v
The program 'rails' is currently not installed.  You can install it by typing:
sudo apt-get install rails

this is my PATH variable

/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/home/motta/.rvm/bin

what should I add to the path to have rails available? thank you

UPDATE: This is the output of rvm list

rvm rubies

=* ruby-1.9.3-p286 [ x86_64 ]

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

The installation has been done following the rvm instructions
https://rvm.io/rvm/install/

SOLVED: When I finished the installation I found out that rvm modified my /home/user/.bashrc file with this line

PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting

therefore I thought that the following one was not needed anymore, which is not the case

[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # This loads RVM into a shell session.

adding the one above to .bashrc solved my problem

Upvotes: 4

Views: 2723

Answers (2)

mpapis
mpapis

Reputation: 53188

Your PATH is obviously set wrong, make sure you use ruby:

rvm use 1.9.3

To make this persistent for next sessions set the default:

rvm use 1.9.3 --default        #OR:
rvm alias create default 1.9.3

Finally you might need to enable login shell to make it working (there are few answers on this topic already).

Upvotes: 0

Dipak Panchal
Dipak Panchal

Reputation: 6036

Try to follow this steps for installing RVM and then install rails

http://rails.vandenabeele.com/blog/2011/11/26/installing-ruby-and-rails-with-rvm-on-ubuntu-11-dot-10/

or

https://rvm.io/rvm/install/

Upvotes: 1

Related Questions