# 1.8 and 1.9 on arch linux

**URL:** <https://www.ruby-forum.com/t/1-8-and-1-9-on-arch-linux/165932>\
**Category:** Ruby\
**Created:** [April 20, 2009, 4:39am UTC](https://www.ruby-forum.com/t/1-8-and-1-9-on-arch-linux/165932 "2009-04-20T04:39:52Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Martin\_DeMello](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/f17d59/32.png) [@Martin\_DeMello](https://www.ruby-forum.com/u/Martin_DeMello)\
**Post date:** [April 20, 2009, 4:39am UTC](https://www.ruby-forum.com/t/1-8-and-1-9-on-arch-linux/165932/1 "2009-04-20T04:39:52Z")

</div>

Anyone on arch linux? I’m trying to get ruby 1.8 and 1.9 playing  
nicely together so that I can easily switch the default “ruby” and  
have everything else (rake, irb, rdoc etc) adjust itself accordingly,  
ideally without subverting the package manager too much.

martin

---

<div class="post-metadata">

**Author:** ![Martin\_DeMello](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/f17d59/32.png) [@Martin\_DeMello](https://www.ruby-forum.com/u/Martin_DeMello)\
**Post date:** [April 20, 2009, 4:41am UTC](https://www.ruby-forum.com/t/1-8-and-1-9-on-arch-linux/165932/2 "2009-04-20T04:41:02Z")

</div>

yes - me!

saji

- Martin DeMello [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) [2009-04-20 11:39:05 +0900]:

> Anyone on arch linux? I’m trying to get ruby 1.8 and 1.9 playing  
> nicely together so that I can easily switch the default “ruby” and  
> have everything else (rake, irb, rdoc etc) adjust itself accordingly,  
> ideally without subverting the package manager too much.
> 
> martin

–  
Saji N. Hameed

APEC Climate Center  
1463 U-dong, Haeundae-gu, +82 51 745 3951  
BUSAN 612-020, KOREA removed\_email\_address@domain.invalid  
Fax: +82-51-745-3999

---

<div class="post-metadata">

**Author:** ![Martin\_DeMello](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/f17d59/32.png) [@Martin\_DeMello](https://www.ruby-forum.com/u/Martin_DeMello)\
**Post date:** [April 20, 2009, 4:48am UTC](https://www.ruby-forum.com/t/1-8-and-1-9-on-arch-linux/165932/3 "2009-04-20T04:48:38Z")

</div>

> yes - me!

sorry, my reply was incomplete… in my case, i just compiled 1.9  
separately  
in a separate directory without using the package manager, and aliased  
the 1.9 version using ruby19 and irb19. In case of 1.9, gems get  
installed  
under the 1.9 installation root without disturbing the main ruby  
installation.  
So I guess rake, rdoc etc should work fine if you use either one (1.8 or  
1.9)

i don’t know if my answer helps much… 🙂

saji

> > martin

–  
Saji N. Hameed

APEC Climate Center  
1463 U-dong, Haeundae-gu, +82 51 745 3951  
BUSAN 612-020, KOREA removed\_email\_address@domain.invalid  
Fax: +82-51-745-3999

---

<div class="post-metadata">

**Author:** ![Martin\_DeMello](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/f17d59/32.png) [@Martin\_DeMello](https://www.ruby-forum.com/u/Martin_DeMello)\
**Post date:** [April 20, 2009, 5:03am UTC](https://www.ruby-forum.com/t/1-8-and-1-9-on-arch-linux/165932/4 "2009-04-20T05:03:15Z")

</div>

On Mon, Apr 20, 2009 at 8:17 AM, Saji N. Hameed [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > yes - me!
> 
> sorry, my reply was incomplete… in my case, i just compiled 1.9 separately  
> in a separate directory without using the package manager, and aliased  
> the 1.9 version using ruby19 and irb19. In case of 1.9, gems get installed  
> under the 1.9 installation root without disturbing the main ruby installation.  
> So I guess rake, rdoc etc should work fine if you use either one (1.8 or 1.9)
> 
> i don’t know if my answer helps much… 🙂

I have that much working already 🙂 What I want to do is have the  
default ruby switch between 1.8 and 1.9 when I run a command - right  
now I run 1.8 as ‘ruby’ and 1.9 as ruby-1.9. I hacked something up by  
manually renaming ruby to ruby-1.8 and adding symlinks, but I was  
hoping there was some sort of standard way to do it.

martin

---

<div class="post-metadata">

**Author:** ![Martin\_DeMello](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/f17d59/32.png) [@Martin\_DeMello](https://www.ruby-forum.com/u/Martin_DeMello)\
**Post date:** [April 20, 2009, 5:51pm UTC](https://www.ruby-forum.com/t/1-8-and-1-9-on-arch-linux/165932/5 "2009-04-20T17:51:26Z")

</div>

Saji N. Hameed  
escribió:\>

> > > ideally without subverting the package manager too much.  
> > > BUSAN 612-020, KOREA removed\_email\_address@domain.invalid  
> > > Fax: +82-51-745-3999

–  
Pablo R. Digonzelli  
Socio Gerente  
Software Solutions  
IP Soluciones  
25 de Mayo 521  
San Miguel de Tucuman  
0381 4304441

---

<div class="post-metadata">

**Author:** ![Martin\_DeMello](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/f17d59/32.png) [@Martin\_DeMello](https://www.ruby-forum.com/u/Martin_DeMello)\
**Post date:** [April 20, 2009, 7:34pm UTC](https://www.ruby-forum.com/t/1-8-and-1-9-on-arch-linux/165932/6 "2009-04-20T19:34:13Z")

</div>

Implement something like the following:

#!/bin/bash

if [$# -eq 0]; then  
version=9  
else  
case $1 in  
-h|-H) echo “usage: $(basename $0) -8|-9 | [-h]”; exit;;  
8|-8) version=8;;  
9|-9) version=9;;  
\*) echo Illegal argument; exit;;  
esac  
fi

if [$version = 9] ;then  
echo Currently your ruby version is 1.9  
rm /usr/bin/ruby  
ln -s /usr/bin/ruby1.9 /usr/bin/ruby  
rm /usr/bin/irb  
ln -s /usr/bin/irb1.9 /usr/bin/irb  
else  
echo Currently your ruby version is 1.8  
rm /usr/bin/ruby  
ln -s /usr/bin/ruby1.8 /usr/bin/ruby  
rm /usr/bin/irb  
ln -s /usr/bin/irb1.8 /usr/bin/irb  
fi

---

<div class="post-metadata">

**Author:** ![Martin\_DeMello](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/f17d59/32.png) [@Martin\_DeMello](https://www.ruby-forum.com/u/Martin_DeMello)\
**Post date:** [April 20, 2009, 10:23am UTC](https://www.ruby-forum.com/t/1-8-and-1-9-on-arch-linux/165932/7 "2009-04-20T10:23:14Z")

</div>

> installation.
> 
> martin

If you are using a Debian based system, you may want to take a look at  
update-alternatives: it maintains symbolic links determining default  
commands (aka. Debian alternatives system)

Cheers  
Alex

---

<div class="post-metadata">

**Author:** ![Martin\_DeMello](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/f17d59/32.png) [@Martin\_DeMello](https://www.ruby-forum.com/u/Martin_DeMello)\
**Post date:** [April 20, 2009, 8:06pm UTC](https://www.ruby-forum.com/t/1-8-and-1-9-on-arch-linux/165932/8 "2009-04-20T20:06:54Z")

</div>

#!/bin/bash

if [$# -eq 0]; then  
version=9  
else  
case $1 in  
-h|-H) echo “usage: $(basename $0) -8|-9 | [-h]”; exit;;  
8|-8) version=8;;  
9|-9) version=9;;  
\*) echo Illegal argument; exit;;  
esac  
fi

if [$version = 9] ;then  
echo Currently your ruby version is 1.9  
rm /usr/bin/ruby  
ln -s $(which ruby1.9) /usr/bin/ruby  
rm /usr/bin/irb  
ln -s $(which irb1.9) /usr/bin/irb  
else  
echo Currently your ruby version is 1.8  
rm /usr/bin/ruby  
ln -s $(which ruby1.8) /usr/bin/ruby  
rm /usr/bin/irb  
ln -s $(which irb1.8) /usr/bin/irb  
fi

If you installed all versions of your ruby in standard places or if your  
path is pointing to them as it should, the above code is more  
appropriate.

---

<div class="post-metadata">

**Author:** ![Martin\_DeMello](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/f17d59/32.png) [@Martin\_DeMello](https://www.ruby-forum.com/u/Martin_DeMello)\
**Post date:** [April 21, 2009, 12:52am UTC](https://www.ruby-forum.com/t/1-8-and-1-9-on-arch-linux/165932/9 "2009-04-21T00:52:50Z")

</div>

Martin DeMello wrote:

> I have that much working already 🙂 What I want to do is have the  
> default ruby switch between 1.8 and 1.9 when I run a command - right  
> now I run 1.8 as ‘ruby’ and 1.9 as ruby-1.9. I hacked something up by  
> manually renaming ruby to ruby-1.8 and adding symlinks, but I was  
> hoping there was some sort of standard way to do it.

I’m not sure if it’s going to help, but what I did was compile ruby1.8  
and 1.9 in separate directories (/opt/ruby/1.8 and /opt/ruby/1.9) and  
then prepend either /opt/ruby/1.8/bin or /opt/ruby/1.9/bin to the $PATH  
depending on which version I want to use.

Daniel
