# Running Multiple Versions of Ruby on Debian?

**URL:** <https://www.ruby-forum.com/t/running-multiple-versions-of-ruby-on-debian/150636>\
**Category:** Ruby\
**Created:** [October 10, 2008, 6:08pm UTC](https://www.ruby-forum.com/t/running-multiple-versions-of-ruby-on-debian/150636 "2008-10-10T18:08:20Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![softf5ajivanet](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/9f8e36/32.png) [@softf5ajivanet](https://www.ruby-forum.com/u/softf5ajivanet)\
**Post date:** [October 10, 2008, 6:08pm UTC](https://www.ruby-forum.com/t/running-multiple-versions-of-ruby-on-debian/150636/1 "2008-10-10T18:08:20Z")

</div>

Well so far things are going kind of good, I’ve built my own server and  
it’s sitting in colo running Debian Etch and Ruby 1.8.6 (built from  
source)

Now me being me I wouldn’t mind running 1.8.7 alongside 1.8.6 for my  
Rails blogging software.

Has anyone had any experiences in running multiple versions of Ruby on  
Debian Etch?

I found one article which explains how to run 3 using  
update-alternatives but pretty unsure if it’ll adapt well to Debian,

[http://blog.michaelgreenly.com/2008/08/multiple-versions-of-ruby-on-ubuntu-2.html](http://blog.michaelgreenly.com/2008/08/multiple-versions-of-ruby-on-ubuntu-2.html)

Seems possible, especially using:

./configure --prefix=/opt/ruby-1.8.7-p71

To set where to install the Ruby version, I’m imagining I’d have to run  
gem --update like,

/opt/ruby-1.8.7-p71/bin/gem --update  
or  
/opt/ruby-1.8.7-p71/bin/gem install rails

to install the necessary gems per ruby install without touching the one  
in /usr/bin/ruby,

then i’m imagining,

/opt/ruby-1.8.7-p71/bin/thin start -C /var/www/apps/myapp/thin.conf  
…to start the thin webserver with my config file

Will try out on a virtual machine first, but am i on the right track or  
is there something better?

---

<div class="post-metadata">

**Author:** ![softf5ajivanet](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/9f8e36/32.png) [@softf5ajivanet](https://www.ruby-forum.com/u/softf5ajivanet)\
**Post date:** [October 10, 2008, 6:14pm UTC](https://www.ruby-forum.com/t/running-multiple-versions-of-ruby-on-debian/150636/2 "2008-10-10T18:14:28Z")

</div>

Alle Friday 10 October 2008, John G. ha scritto:

> I found one article which explains how to run 3 using  
> gem --update like,  
> /opt/ruby-1.8.7-p71/bin/thin start -C /var/www/apps/myapp/thin.conf  
> …to start the thin webserver with my config file
> 
> Will try out on a virtual machine first, but am i on the right track or  
> is there something better?

I’d also suggest to pass configure the --program-prefix or  
–program-suffix  
arguments. This way, you can call the ruby 1.8.7 executable ruby187,  
instead  
of just ruby and you won’t have to use its full path every time you want  
to  
use it. The same happens with the other executables, like irb and ri.

Stefano

---

<div class="post-metadata">

**Author:** ![softf5ajivanet](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/9f8e36/32.png) [@softf5ajivanet](https://www.ruby-forum.com/u/softf5ajivanet)\
**Post date:** [October 10, 2008, 6:23pm UTC](https://www.ruby-forum.com/t/running-multiple-versions-of-ruby-on-debian/150636/3 "2008-10-10T18:23:53Z")

</div>

On Fri, Oct 10, 2008 at 9:05 AM, John G. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> Seems possible, especially using:
> 
> ./configure --prefix=/opt/ruby-1.8.7-p71
> 
> To set where to install the Ruby version, I’m imagining I’d have to run  
> gem --update like,
> 
> /opt/ruby-1.8.7-p71/bin/gem --update

> is there something better?

## I just create files with appropriate PATH settings, like

## export RUBY\_HOME=/opt/ruby-1.8.7-p71 PATH=$RUBY\_HOME/bin:$PATH

Name them sensibly, and you can just type, e.g.  
prompt% . 187  
to source, and voila! No need to enter the entire path, or remember  
to use a different name.

FWIW,

---

<div class="post-metadata">

**Author:** ![softf5ajivanet](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/9f8e36/32.png) [@softf5ajivanet](https://www.ruby-forum.com/u/softf5ajivanet)\
**Post date:** [October 10, 2008, 6:24pm UTC](https://www.ruby-forum.com/t/running-multiple-versions-of-ruby-on-debian/150636/4 "2008-10-10T18:24:52Z")

</div>

Thanks Stefano,

so if i were to do,

./configure --prefix=/opt/ruby-1.8.7-p71 --program-suffix=187

to make ruby187 point to /opt/ruby-1.8.7-p71/ruby ?

---

<div class="post-metadata">

**Author:** ![softf5ajivanet](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/9f8e36/32.png) [@softf5ajivanet](https://www.ruby-forum.com/u/softf5ajivanet)\
**Post date:** [October 10, 2008, 6:28pm UTC](https://www.ruby-forum.com/t/running-multiple-versions-of-ruby-on-debian/150636/5 "2008-10-10T18:28:36Z")

</div>

Alle Friday 10 October 2008, John G. ha scritto:

> Thanks Stefano,
> 
> so if i were to do,
> 
> ./configure --prefix=/opt/ruby-1.8.7-p71 --program-suffix=187
> 
> to make ruby187 point to /opt/ruby-1.8.7-p71/ruby ?

It doesn’t create a symlink. It will change the name of the ruby  
executable:  
not

/opt/ruby-1.8.7-p71/ruby

but

/opt/ruby-1.8.7-p71/ruby187

If you then put /opt/ruby-1.8.7-p71 in your PATH, you’ll be able to use  
ruby187 to call the new version and ruby to call the old version.

Stefano

---

<div class="post-metadata">

**Author:** ![softf5ajivanet](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/9f8e36/32.png) [@softf5ajivanet](https://www.ruby-forum.com/u/softf5ajivanet)\
**Post date:** [October 19, 2008, 10:28pm UTC](https://www.ruby-forum.com/t/running-multiple-versions-of-ruby-on-debian/150636/6 "2008-10-19T22:28:05Z")

</div>

John G.:

> Has anyone had any experiences in running  
> multiple versions of Ruby on Debian Etch?

I run hand-compiled Ruby 1.8.6, 1.8.7 and 1.9.0 alongside  
each other by putting them in ~/opt with, for example,  
./configure --prefix=/home/shot/opt/ruby-1.8.7-p72

I then have ~/opt/ruby-1.8.7 symling poiting to it, plus

export PATH\_ORIG="$PATH"  
export PATH="/var/lib/gems/1.8/bin:$PATH\_ORIG"

in my ~/.bashrc plus

alias r7=‘export PATH="/home/shot/opt/ruby-1.8.7/bin:$PATH\_ORIG"’  
alias r8=‘export PATH="/home/shot/opt/ruby-1.8.6/bin:$PATH\_ORIG"’  
alias r9=‘export PATH="/home/shot/opt/ruby-1.9.0/bin:$PATH\_ORIG"’

in my ~/.bash\_aliases â€“ this way I get the systemâ€™s Ruby+RubyGems by  
default and can switch to my hand-compiled environment when I want to  
run Ruby 1.8.6, 1.8.7 or 1.9.0.

Ruby 1.9 comes with RubyGems, in the cases of Ruby 1.8 you need to  
download the tarball and then run `ruby setup.rb` with the proper,  
hand-compiled Ruby binary.

I hand-compile 1.8.6 because Debian and Ubuntu by  
default --enable-pthreads which is a performance killer.

export CFLAGS=’-O3 -march=native’  
should also boost performance, but in  
my case the differences are neglible.

– Shot
