How to update my version of Ruby from terminal? - ruby

I ran the command 'ruby -v' on my Linux Mint 10 virtual machine and got:
stapiagutierrez#Sergio-Linux-VM ~/Desktop/Tickets/tickets $ ruby -v
ruby 1.8.7 (2010-06-23 patchlevel 299) [i686-linux]
How can I upgrade it to the latest version, 1.9.2?

I would suggest using RVM. That way you can keep the 1.8.7 version of Ruby, but you can also install new ones easily:
rvm install 1.9.2
And switch between them with no effort:
rvm 1.8.7
rvm 1.9.2
Using rvm you can set your default version of Ruby like this:
rvm --default use 1.9.2

Related

I can't install the first version of any Ruby with RVM

When I try to install the 1.8.7 version of Ruby:
rvm install 1.8.7
He actually install Ruby 1.8.7-head (1.8.7 patchlevel 376).
How can I install the real first version (http://cache.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7.tar.gz)?
Try this:
rvm install 1.8.7 -l 0
or
rvm install 1.8.7-p0
RVM is installing the latest patchlevel by default, so you need to specify the patchlevel that you want.

Ruby 1.9.1 installed, however Ruby --version shows different version

I installed ruby via
apt-get install ruby1.9.1 rubygems
However, when I run ruby --version I see
ruby 1.8.7 (2011-06-30 patchlevel 352) [x86_64-linux]
Have I missed something? When I try to run a gem which requires 1.9+ it fails and asks me to upgrade.
The package ruby1.9.1 will give you an executable called ruby1.9.1, which you should use instead of ruby.
You can set ruby1.9.1 as default ruby version using following command
update-alternatives --set ruby /usr/bin/ruby1.9.1
You may find out about available alternatives using following
update-alternatives --query ruby
In this way you can set the default ruby version
$ rvm --default use 1.9.2
$ ruby -v
ruby 1.9.2p0 (2010-08-18 revision 29036) [x86_64-darwin10.4.0]

ruby & rvm - how to install a "p" version of ruby

How can I use rvm to install a specific version of Ruby, e.g. 1.9.3p327 instead of the current 1.9.3p194 that I have.
All the references and document are about the major version, e.g. rvm install 1.9.3 but don't mention the 'p' minor version numbers.
I tried
$ rvm install 1.9.3p327
Unknown ruby interpreter version: '1.9.3p327'.
Could not detect ruby version/name for installation, please be more specific.
$ ruby -v
ruby 1.9.3p194 (2012-04-20 revision 35410) [i686-linux]
$ rvm install '1.9.3p327'
Unknown ruby interpreter version: '1.9.3p327'.
Could not detect ruby version/name for installation, please be more specific.
Turned out to be a dash ! $ rvm install 1.9.3-p327
rvm install 1.9.3p327 should work without single quotes.
EDIT: The following option is now deprecated.
Alternatly, to install a patch specific level you could use the -l option. For example
rvm install 1.9.3 -l 327

Ruby 1.9.3 with rvm on Mac Lion installs, but doesn't show up in Ruby or irb

On Mac OS X running Lion 10.7.3 and having Xcode 4.3.2, I find that installing ruby 1.9.3 through rvm and setting default to use 1.9.3 still shows ruby -v to be 1.8.7 (irb RUBY_VERSION also shows 1.8.7).
$ ruby -v
ruby 1.8.7 (2010-01-10 patchlevel 249) [universal-darwin11.0]
$ rvm install 1.9.3 --with-gcc=clang
<installs successfully>
$ rvm --default 1.9.3
$ ruby -v
ruby 1.8.7 (2010-01-10 patchlevel 249) [universal-darwin11.0]
$ irb
>> RUBY_VERSION
=> "1.8.7"
How do I get ruby and irb to use ruby 1.9.3 on this configuration?
Update: Looks like I had an older version of rvm. I installed Jewelry Box (OS X rvm GUI tool), which reinstalled rvm, and then updated the ruby to use from within jewelry box. This did the trick. Thanks all for your help.
Thanks
If you have successfully installed ruby 1.9.3
then you can check it by this command either installed or not
rvm list
then all rubies listing will be display...
then if you select any rubu version use this command
rvm use ruby-1.9.3 --default
and enjoying.........
rvm get head will update your RVM installation in place to the current release. It's a good idea to do that periodically, just to keep up with the bug fixes and new features.
I had a similar issue and wanted to post my solution as it may be helpful for someone. I switched to 1.9.3 in my terminal window and then opened another window to use IRB in that window. When I did
RUBY_VERSION
in IRB it told me I was using 1.8.7. I realized after that I shouldn't have opened another window to do it. It works just fine if I stay in the same window, make sure I am using 1.9.3 and then go into IRB from there.
Thought someone else might have a use case like mine and this would help.

Ruby 1.9.2 not installing on OSX?

I've got Xcode 3.2.1
I've installed Git and RVM
I've installed Ruby 1.9.2, it's installed 100%
I run ruby -v but instead of seeing
ruby 1.9.2p0 (2010-08-18 revision 29036) [x86_64-darwin10.4.0]
I see
ruby 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0]
I don't see what I could be going wrong
Try
rvm 1.9.2
Or
rvm --default 1.9.2
It is possible to use a .rvmrc to do that for the directory you cd into as well.
Have you selected the version of ruby you want to use with rvm? As in this? Note the "rvm 1.9.2" line hidden away after the rvm and ruby installs.
Type in 'rvm 1.9.2' and then type 'ruby -v'... did you do that? It looks like the Ruby 1.8.7 on your machine is the one included with OS X.

Resources