# Proper way to set ruby to 1.9



## phreak (Dec 9, 2011)

I have got this question a long time.
I prefer to use ruby 1.9 over 1.8; therefore, I have added

```
RUBY_VERSION=1.9
```
to /etc/make.conf.
It was fine until there was a vulnerability discovered on ruby 1.9.1.
While there is a ruby 1.9.2 ports on FreeBSD 8.1, the above line failed to get the latest one. I had to changed to

```
RUBY_VERSION=1.9.2
```
in order to get it change to 1.9.2 instead.

Now, I have upgrade FreeBSD from 8.1 to 8.2 and I have recompile all the ports from scratch again. I have set *RUBY_VERSION* to 1.9.3 in order to get the latest version without being blocked by the vulnerability. Unfortunately, I cant't get ruby-iconv installed. It complains 
	
	



```
$ sudo make install clean
===> No options to configure
===>  License check disabled, port has not defined LICENSE
===>  Extracting for ruby19-iconv-1.9,1
===>   ruby19-iconv-1.9,1 depends on file: /usr/local/bin/ruby19 - found
/bin/mkdir -p /usr/ports/converters/ruby-iconv/work
/bin/ln -sf /usr/ports/lang/ruby19/work/iconv /usr/ports/converters/ruby-iconv/work/
===>  Patching for ruby19-iconv-1.9,1
===>   ruby19-iconv-1.9,1 depends on file: /usr/local/bin/ruby19 - found
===>   ruby19-iconv-1.9,1 depends on file: /nonexistent - not found
===>    Verifying patch for /nonexistent in /usr/ports/lang/ruby19
===>  ruby-1.9,1 has known vulnerabilities:
=> ruby -- UTF-7 encoding XSS vulnerability in WEBrick.
   Reference: [url]http://portaudit.FreeBSD.org/34e0316a-aa91-11df-8c2e-001517289bf8.html[/url]
=> ruby -- multiple vulnerabilities in safe level.
   Reference: [url]http://portaudit.FreeBSD.org/c329712a-6b5b-11dd-9d79-001fc61c2a55.html[/url]
=> ruby -- DoS vulnerability in WEBrick.
   Reference: [url]http://portaudit.FreeBSD.org/f7ba20aa-6b5a-11dd-9d79-001fc61c2a55.html[/url]
=> ruby -- DNS spoofing vulnerability.
   Reference: [url]http://portaudit.FreeBSD.org/959d384d-6b59-11dd-9d79-001fc61c2a55.html[/url]
=> Please update your ports tree and try again.
*** Error code 1

Stop in /usr/ports/lang/ruby19.
*** Error code 1

Stop in /usr/ports/lang/ruby19.
*** Error code 1

Stop in /usr/ports/converters/ruby-iconv.
```
 when I set to 1.9.
and complains 
	
	



```
$ sudo make install clean
===> No options to configure
===>  ruby19-iconv-1.9.3,1 Only ruby 1.8 and 1.9 are supported.
*** Error code 1

Stop in /usr/ports/converters/ruby-iconv.
```

What value should I set RUBY_VERSION to?
How come 1.9 does not imply the latest in 1.9?
How to install ruby-iconv?

Many Thanks!


----------



## phreak (Dec 9, 2011)

I have just solved the problem with

```
RUBY_VERSION=1.9.3
RUBY_DEFAULT_VER=1.9
```
in /etc/make.conf

Is it the way to go? It means I have to explicitly tell make the ruby micro version?


----------



## phreak (Dec 9, 2011)

Furthermore, I have strange problem. gem is missing. I cannot find gem or gem19 in /usr/local/bin now. How do I get it back? (head scratching)


----------



## jb_fvwm2 (Dec 9, 2011)

Just a few commands that may help

```
cd /var/db/pkg
ls -lac  | grep ruby (see any ruby 18 remaining?)
```
another...
	
	



```
cd /usr/local/lib/ruby/1.8 && find . -type f
cd /usr/local/lib/ruby/site_ruby/1.8 && find . -type f
```
Just earlier today I fixed a lot of those, changing from 1.8 to 1.9 on a machine.
(you may find other stuff to reinstall under  ruby ...
(I used mostly the command 
	
	



```
portmaster -d -B -P -i -g /var/db/pkg/... /var/db/pkg...
```
In retrospect, the commands are of little use if you did not have 1.8 installed.  Just after writing this post, I remembered the correct answer (see below) as I had to (re-)install it also.


----------



## phreak (Dec 9, 2011)

Thanks for suggestions. I have tried to verify the installation of ruby18 and here is the result:

```
$ cd /var/db/pkg
$ ls -lac  | grep ruby
drwxr-xr-x    2 root  wheel       512 Dec  9 11:47 ruby-1.9.3,1
drwxr-xr-x    2 root  wheel       512 Dec  9 11:03 ruby19-bdb-0.6.6
drwxr-xr-x    2 root  wheel       512 Dec  9 11:29 ruby19-iconv-1.9.3,1
$ cd /usr/local/lib/ruby/1.8 && find . -type f
-bash: cd: /usr/local/lib/ruby/1.8: No such file or directory
$ cd /usr/local/lib/ruby/site_ruby/1.8 && find . -type f
-bash: cd: /usr/local/lib/ruby/site_ruby/1.8: No such file or directory
```

After executing [cmd=]portmaster -d -B -P -i -g /var/db/pkg/ruby-1.9.3,1[/cmd] *find /usr/local/bin gem* still yields no results.


----------



## wblock@ (Dec 9, 2011)

Install devel/ruby-gems.


----------



## phreak (Dec 12, 2011)

wblock@, You nailed it. Thanks for your help!


----------

