Terminal and Control panel shows different version of ruby - ruby

I type ruby -v and this shows
ruby version 2.1.5p273
but in my control panel, ruby version is 2.2.1-p85
I tried to change the version with rvm use ruby-2.2.1 in the terminal but it returns 'rvm' as not internal or external command.
I am using railsinstaller btw

Related

switch to ruby version installed through RVM

my macbook is OSX El Capitan. It has Apple pre-installed universal Ruby version 2.0.0.
Now, I want to use latest Ruby 2.3.0. I managed to use rvm to install Ruby 2.3.0. I see the following message after rvm finished installing ruby 2.3.0:
Ruby was built without documentation, to build it run: rvm docs generate-ri
/Users/John/.rvm/bin/rvm: line 66: shell_session_update: command not found
Creating alias default for ruby-2.3.0...
* To start using RVM you need to run `source /Users/John/.rvm/scripts/rvm`
in all your open shell windows, in rare cases you need to reopen all shell windows.
I followed this message, & run command
source /Users/John/.rvm/scripts/rvm
but when I run ruby -v, the version is still Apple pre-installed Ruby 2.0.0. How can I switch to the ruby I installed through rvm?
(under path .rvm/rubies I can find ruby-2.3.0)
To switch to using 2.3.0, do
rvm use 2.3.0
To make it default, do
rvm use --default 2.3.0

RVM not loading automatically

I have installed RVM and it works. I can change the version of ruby and do all of the other things expected with RVM. however, if I close the current terminal window and open a new one, the new terminal window forgets about RVM. Here's an example:
After opening a new terminal window, I do the following:
$ ruby -v
ruby 1.9.3p484
$ source ~/.bash_profile
$ ruby -v
ruby 2.1.0p0
Ruby 2.1.0p0 is set as the default RVM version. it only loads properly after I reload bash_profile.
I am using Ubuntu with the kubuntu window manager. Any ideas??
what is the o/p of $rvm reload and $rvm notes after you open a new terminal.
Also check out $rvm list
This shows the list for ruby installation available with their version and the default currently being used. You can always change this using $rvm use 1.9.3 --default. If you want any specific version to be loaded for an application, edit the .rvmrc file specifying the ruby version to be used.

(Mac Terminal) "System" message when trying to install latest ruby with RVM

I'm a total newbie when it comes to using Terminal, so I don't really understand what's happening here when I try to upgrade my ruby version (1.8.7) with rvm on a Mac OS X 10.7.3.
When I input
rvm install current && rvm use current
I get this
system
system
What does this mean? And how can I proceed with the installation of the latest version?
The current rvm command outputs the name of the currently active installation of Ruby; in this case, it's using your system's pre-installed Ruby (1.8.7).
Try this:
rvm install 2.0 # (or whatever version you need)
rvm use 2.0 --default # this sets the default to the 2.0 install

ruby and rails return to earlier versions when I close and reopen terminal

I'm trying to upgrade Ruby from 1.8.7 to the latest version and Rails from 2.3.14 to the latest version. I ran:
\curl -L https://get.rvm.io | bash -s stable --ruby --autolibs=enable --auto-dotfiles
and then it tells me to run:
source /home/USER/.rvm/scripts/rvm
in all of my open shell windows, which is just the one so I do that. If I type:
ruby -v
It tells me I have 2.0.0p195 which is okay (although I kinda wanted 1.9.2), but if I close that window, and type the same thing any time I open a shell window again, it tells me I only have 1.8.7. Something similar happens if I try installing Rails after installing Ruby this way.
I'm on Ubuntu 12.04
EDIT:
I'm using RVM. I installed it according to the answer from this stackoverflow question because it was originally a broken version (that's where my command from above comes from):
Installed Ruby 1.9.3 with RVM but command line doesn't show ruby -v
Try this:
rvm use --default 2.0.0
It occurs probably because your default ruby version is 1.8.7. You can quickly check it with
rvm list
To install 1.9.2, simply type:
rvm install 1.9.2

How do I update my Ruby version if I have multiple versions installed?

I managed to use rvm (Ruby Version Manageer) to update to the latest Ruby version (ruby-1.9.2-p180). To do this I ran the following commands:
rvm install ruby-1.9.2-p180
rvm ruby-1.9.2-p180
ruby -v
The output of that last command indicates that it is successfully installed:
ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-darwin10.7.0]
Running a "which ruby" command indicates that I'm using the correct Ruby version as well:
/Users/Bijan/.rvm/rubies/ruby-1.9.2-p180/bin/ruby
So in the current Terminal session, the new Ruby is installed properly. However, whenever I open a new Terminal session, it defaults me back to the original version I was running:
ruby -v
ruby 1.9.2p136 (2010-12-25 revision 30365) [x86_64-darwin10.6.0]
which ruby
/usr/local/bin/ruby
So, in other words, I seem to have to different versions properly installed, but the default is going to the /usr/local/bin instead of the RVM installation. How do I go about making sure that the default Ruby version that I am using is the most recent?
You can set your default ruby version to be the latest with the following:
rvm --default use <ruby version here>
By default, the system ruby is your default in RVM
create a .rvmrc file under the directory (~/ in your case) which includes the following:
rvm use ruby-1.9.2-p180
save it and you are good to go.

Resources