Install ruby 1.9.1

I spent an hour trying to find reasonable instructions on how to
install ruby 1.9.1 as a standalone ruby instance. Everything seems to
be directed at side-by-side 1.8/1.9 installation.

I found this in some ad swamp, but it was sadly more appropriate than
anything else I could find on the web that wasn’t apt-get ruby.(1.8.7)

ruby 1.9.1 is installed in opt/ruby but the system doesn’t know about
it.
opt/ruby/bin/ruby -v works, but ruby -v tells me ruby isn’t installed.

I guess I need to put ruby in the path or create a symlink or
something, but I am not sure what to do.

Thanks in advance.

Here is what I did:

1: Download ruby 1.9.1,
ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.1-p0.tar.gz
( I actually got p243 at
ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.1-p243.tar.gz)

2: To ensure that the installation of the necessary tools
sudo apt-get install build-essential
sudo apt-get install autoconf

3:
tar xzvf ruby-1.9.1-p0.tar.gz
cd ruby-1.9.1-p0(actually p243)
autoconf
sudo makedir /opt/ruby
./configure --prefix=/opt/ruby --enable-pthread
make
sudo make install

4 Installed?
/opt/ruby/bin/ruby -v

Ruby F. wrote:

I spent an hour trying to find reasonable instructions on how to
install ruby 1.9.1 as a standalone ruby instance. Everything seems to
be directed at side-by-side 1.8/1.9 installation.

Hi!

I found this in some ad swamp, but it was sadly more appropriate than
anything else I could find on the web that wasn’t apt-get ruby.(1.8.7)

ruby 1.9.1 is installed in opt/ruby but the system doesn’t know about
it.
opt/ruby/bin/ruby -v works, but ruby -v tells me ruby isn’t installed.

I guess I need to put ruby in the path or create a symlink or
something, but I am not sure what to do.

Looks like, you using some kind of debian based system…for which /opt
is made for ‘foreign’ software like Adobe-Reader. /opt/bin has to be
added to the PATH-variable. Depending on which kind of shell you use, or
if this ruby installation should be accessible for all users, you
should edit ~/.bashrc or ~/.zshrc (enable ruby only for you)
bashrc: PATH=/opt/bin:$PATH
zshrc: path=(/opt/bin $path)
or
/etc/profile or a single script under /etc/profile.d/ (for all user)

It all depends on you operating system.

apt-get is quite comfortable despite of the fact, that ruby (like any
another reasonable composed software) is debianized, i.e. hacked into
tiny little packages. Do you need a special ruby version?

regards
ralf

it.
1.9.1-p0.tar.gz
autoconf
sudo makedir /opt/ruby
./configure --prefix=/opt/ruby --enable-pthread
make
sudo make install

4 Installed?
/opt/ruby/bin/ruby -v

Why the special configure options? On my Ubuntu system I simply did

./configure
make
sudo make install

Done! Everything works properly.

Hope that helps.

Thanks for all your help.
I guess I neglected to mention that I am running Ubuntu 9.10 (which is
flippin wonderful)
and I wanted to run the latest and greatest and had the impression
that Rails 2.3 and Ruby 1.9.1 where a match made in heaven.
Maybe-so I need to back off a bit.
It is a new install so if I muck it up, I will just wipe the box and
start over.

TW Scannell

On Tuesday 08 December 2009 12:15:06 am Ruby F. wrote:

I spent an hour trying to find reasonable instructions on how to
install ruby 1.9.1 as a standalone ruby instance.

sudo apt-get install ruby1.9.1

Everything seems to
be directed at side-by-side 1.8/1.9 installation.

Mostly because it’s not really to where we can safely ignore either of
them.
But you could probably adapt this:

<http://groups.google.com/group/rails-
oceania/browse_thread/thread/8a2b256d117db49f>

Just ignore the parts about 1.8.

Or, better yet – the only real reason you can’t just ‘apt-get install
ruby1.9.1’, or for that matter, ‘apt-get install ruby1.9.1 rubygems1.9.1
irb1.9.1 ruby1.9.1-dev …’

…is because it installs the binary as /usr/bin/ruby1.9.1, which is
going to
be annoying and inconvenient.

But yeah, basically, anything that told you to install rubyfoo or
libfoo-ruby
or anything like that, chances are, there’s an equivalent package for
1.9.1.

3:
tar xzvf ruby-1.9.1-p0.tar.gz
cd ruby-1.9.1-p0(actually p243)
autoconf
sudo makedir /opt/ruby
./configure --prefix=/opt/ruby --enable-pthread
make
sudo make install

4 Installed?
/opt/ruby/bin/ruby -v

yuck.

I guess you could upgrade, since it may be awhile before Ubuntu/Debian
pick up
the latest patch set. But since this is the version you’d be doing
anyway, I’d
do:

sudo rm -rf /opt/ruby

Then do this:

cd /usr/local/bin
for i in /usr/bin/*1.9.1; do sudo ln -s $i basename $i 1.9.1; done

And you’re done.

Be aware that not everything works in 1.9.1 yet, so you may end up
wanting
some options after all.

On Tuesday 08 December 2009 11:10:08 am Ruby F. wrote:

Thanks for all your help.
I guess I neglected to mention that I am running Ubuntu 9.10 (which is
flippin wonderful)
and I wanted to run the latest and greatest and had the impression
that Rails 2.3 and Ruby 1.9.1 where a match made in heaven.

I’m on Ubuntu 9.10, and the instructions I gave you will almost
certainly work
for using Rails 2.3 and Ruby 1.9.1. All you need to do is create
symlinks to
the ruby1.9.1, gem1.9.1, rdoc1.9.1, and generally foo1.9.1 programs
somewhere
in your PATH, and you can use the Ubuntu Ruby 1.9.1 packages.

By “not everything works”… Rails works, and a lot of things do work.
Occasionally, though, you’ll find a gem or library that hasn’t been
updated
yet – and it’s much harder to find stuff that doesn’t work in 1.8.