So I was looking around for instructions on how to install Ruby Enterprise Edition on FreeBSD using RVM (Ruby Version Manager).

I found this, but it didn't seem to work for me, however let it be known I did use it as a basis for this step-by-step!

Please note that although this will work, there are certain parts that could probably be done better. Any advice, idea, suggestion is very appreciated.

NOTE: This DID NOT work for me for ree-1.8.7-2011.03. It only works for ree-1.8.7-head- in a different post I'll show how to install Ruby 1.9.2

So after some fiddling around I finally managed to get the steps down that best worked for me and decided to share them with anyone else struggling.

PREREQUISITES:

Installing RVM:

RVM cannot be installed on the csh, you'll need bash for that. So let's go ahead and install bash along with some other programs we'll need along the way:

pkg_add -r git bash curl

Now that we have bash, let's make sure we login everytime using that.

ee ~/.cshrc

add the lines:

setenv SHELL /usr/local/bin/bash
/usr/local/bin/bash

exit and re-login to make the changes take effect.

Now we're in bash:

[root@bsd1 ~]#

Type:

bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)
echo 'source /usr/local/rvm/scripts/rvm -v > /dev/null' >> ~/.bashrc

The commands above will download RVM and make sure it's started every time we're in bash. The > /dev/null will simply redirect the output of rvm -v to /dev/null so it won't be displayed every time you login. This is ugly, but yes it works.

once again exit and re-login to make the changes take effect.

Let's make sure it works, try the following:

type rvm | head -1

You should get:

rvm is a function

That's it! RVM is now installed and ready.

Installing Ruby Enterprise Edition:

Before we can go ahead and install Ruby Enterprise Edition we need a regular version of ruby installed. The easiest way to go about this is installing ruby from the packages.

pkg_add -r ruby

Also for the compilation to go through we'll need autoconf and automake installed from ports:

Install autoconf:

cd /usr/ports/devel/autoconf;make install clean

-took less than a minute

Now install automake:

cd /usr/ports/devel/automake;make install clean

-also took less than a minute

Before installing Ruby Enterprise Edition install iconv:

pkg install iconv

Now go ahead and install Ruby Enterprise Edition:

rvm install ree-1.8.7-head --with-iconv-dir=$rvm_path/usr

-took about 2 minutes

When it's done check that it installed succesfully:

rvm list

you should get:

rvm rubies

=> ree-1.8.7-head [ i386 ]

the => indicates that this is the default Ruby version that the system will use. If you do NOT see the => then that is not the version your system is using. That's easy to fix however, just type:

rvm --default use ree-1.8.7-head

you should see:

Using /usr/local/rvm/gems/ree-1.8.7-head

Double check by doing:

ruby -v

you should get:

ruby 1.8.7 (2011-02-18 patchlevel 334) [i386-freebsd8.2]

That's it! Ruby Enterprise Edition is installed!