I installed RVM using the single instruction mentioned at the RVM website (using git).
Then I installed Ruby version 1.9.2 and 1.8.7 using:
rvm insta
Ruby is not in your path. In simple terms, RVM handles the switching of Ruby in your path. Look at the output of the command-line tool
printenv
You should see something similar to:
PATH=/Users/myuser/.rvm/gems/jruby-1.5.6/bin
See Tin Man's response, it should get you were you need to go.
Are you making sure to source /usr/local/lib/rvm? echo 'source /usr/local/lib/rvm' >> ~/.bashrc
and relog via SSH/start a new instance of Bash.
To clarify, since there is some confusion: there are two ways to install RVM: a "per user" install, and a "system wide" install.
For most day-to-day use, you want to use a "per user" install, which installs RVM into ~/.rvm
. System-wide installs are good for servers, where one set of Rubies should be used. The default location for RVM in this case is /usr/local/rvm
.
Based on your question, it appears you've installed RVM as a system-wide install.
To use RVM, it must be initialized by running a script each time you log in. To do this easily, you include the file in your ~/.bashrc
file (or ~/.bash_profile
if you're on OS X), so that it is automatically run each time you log in. For a per user install, add the following text to the file:
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"
for system wide installs, use this text instead:
[[ -s "/usr/local/lib/rvm" ]] && . "/usr/local/lib/rvm"
If you do indeed have a system-wide install, you will also need to make sure you are a member of the rvm group; type the following to do so:
sudo adduser `whoami` rvm
Once you have made the necessary changes, log out of your session and then log back in. Once you have done so, rvm use 1.9.2
should set a bunch of environment variables, which you can see by typing rvm info
. If all is well, ruby
should execute correctly.
I faced the same issue. I just executed the command:
/bin/bash --login
I noticed that source
line was correctly in .bash_profile but I kept getting ruby command not found. So, when I checked rvm list
, I figured out none ruby was selected:
rvm list
rvm rubies
ruby-2.4.0 [ x86_64 ]
# Default ruby not set. Try 'rvm alias create default <ruby>'.
# => - current
# =* - current && default
# * - default
then I did the selection through rvm use 2.4.0
and checked again
rvm list
rvm rubies
=> ruby-2.4.0 [ x86_64 ]
# Default ruby not set. Try 'rvm alias create default <ruby>'.
# => - current
# =* - current && default
# * - default
Look the arrow close the installed ruby and the commented subtitles. After that ruby -v
finally answered me
ruby 2.4.0p0 (2016-12-24 revision 57164) [x86_64-linux]
I hope this help. Cheers.
edit: You can use rvm --default use 2.4.0
to set it as default ruby version
rvm use 2.6.3 --default
can fix it, but when I shut down my Ubuntu, the problem appearance once again!!
this link helped me.https://github.com/rvm/rvm/issues/3682
sudo vim .bash_profile
[[ -s "$HOME/.profile" ]] && source "$HOME/.profile" # Load the default .profile
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session as a function
I installed Ruby on Rails on a Ubuntu 11.10 VM, using "HOW TO INSTALL RUBY ON RAILS IN UBUNTU 11.10".
After installing it, I was running into the same issue. The only thing that seems to be missing from the tutorial in my opinion, is the following command:
rvm --default use 1.9.2
Although Ruby is properly installed, RVM seems to redefine in each session Ruby is to be used. The problem was that the default Ruby pointed to the "system ruby", and, in my case, this one pointed to nowhere and made the call rvm info
return a result similar to the initial post.
To solve this issue, one of the follwings commands must be used:
rvm --default use 1.9.x
or (valid only for the current session)
rvm use 1.9.x
Before I could start the server, I also came across "ExecJS and could not find a JavaScript runtime". As proposed in several answers, I solved it by adding the following lines to the Gemfile.
gem 'execjs'
gem 'therubyracer'
and running bundle install
afterwards.