Installing Ruby19 on Gentoo

Surviving in Gentoo masking nightmare
Added by Christoph Kappel over 7 years ago

Installing Ruby 19 isn't an easy task, the (hard)masking stuff in Gentoo is really a nightmare. The API of Ruby changed a lot from 18 to 19, therefore you can easily say it's not compatible. Until Gentoo has a better version management for slotted Ruby is basically, it's just masked and up to the user installing it if needed and live with the consequences.

There exists the fancy RUBY_TARGETS mechanism, which is intended to allow packages be build for different flavors like ruby18, ruby19, jruby and ree (Ruby Enterprise Edition). According to the manpage and the nice guys in #gentoo-ruby on Freenode you just need to add RUBY_TARGETS="ruby19" in your /etc/make.conf - it doesn't.

After a bit of talk and testing various possible solutions suggestions I found it: You need to override the mask of the flag for ruby19 which is ruby_targets_ruby19 and this can be done in /etc/portage/profile/use.mask.

To make long story short just do this:

Numbers: on /off1 mkdir -p /etc/portage/profile
2 echo "dev-lang/ruby ~x86" >> /etc/portage/package.keywords
3 echo "dev-lang/eselect-ruby ~x86" >> /etc/portage/package.keywords
4 echo "dev-lang/ruby" >> /etc/portage/package.unmask
5 echo "dev-lang/eselect-ruby" >> /etc/portage/package.unmask
6 echo "-ruby_targets_ruby19" >> /etc/portage/profile/use.mask
7 echo 'RUBY_TARGETS="ruby19"' >> /etc/make.conf

In case you also need rake:

Numbers: on /off1 echo "dev-ruby/rake ~x86" >> /etc/portage/package.keywords
2 echo "dev-ruby/rubygems ~x86" >> /etc/portage/package.keywords
3 echo "dev-ruby/rake" >> /etc/portage/package.unmask
4 echo "dev-ruby/rubygems" >> /etc/portage/package.unmask