Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Amazon Linux latest ruby

Amazon Linux 2012.03 now comes with ruby 1.9.3

To install it (as per the docs)

sudo yum install ruby19

But ruby -v shows 1.8.7. How would I switch it over 1.9.3 (If its already there there would be no need to use RVM yes?)

like image 536
Tarang Avatar asked Apr 12 '12 18:04

Tarang


3 Answers

The right way to do this on Amazon Linux is:

sudo yum update (to get latest version of Amazon Linux (2013.09 at time of this answer)
yum install ruby19 
alternatives --set ruby /usr/bin/ruby1.9
like image 119
danieljimenez Avatar answered Nov 14 '22 05:11

danieljimenez


Supplementing @baboonWorksFine's answer, there are a number of 1.9 commands that can be symlinked as their undecorated equivalents. What I did was:

sudo -s
for f in /usr/bin/*1.9
do
  ln -s $f ${f%1.9}
done

That way, you don't accidentally miss any commands that need aliasing.

like image 8
Ian Dickinson Avatar answered Nov 14 '22 05:11

Ian Dickinson


If you do this:

ls -l /usr/bin/ruby*

you will probably see this:

lrwxrwxrwx 1 root root    7 Apr 26 18:27 /usr/bin/ruby -> ruby1.8
-rwxr-xr-x 1 root root 3720 Mar 29 08:29 /usr/bin/ruby1.8
-rwxr-xr-x 1 root root 3888 Mar 29 12:26 /usr/bin/ruby1.9

This is well self explained. So what you wanna do is:

rm /usr/bin/ruby && ln -s /usr/bin/ruby1.9 /usr/bin/ruby
like image 7
Rn2dy Avatar answered Nov 14 '22 06:11

Rn2dy