rvm and gentoo

If you are a Gentoo and Ruby user and you have decided to try out rvm you might end up having trouble using gems. In particular if you see this error message this post might be some help.

gem -v

 <internal:lib/rubygems/custom_require>:29:in `require': no such file to load -- auto_gem (LoadError)

        from <internal:lib/rubygems/custom_require>:29:in `require'

The likely culprit here is for some reason whoever maintains the Ruby/Gem ebuild has decided to set an environmental variable that changes Ruby's default behaviour for you.... RUBYOPT="-rauto_gem"

You can temporarily disable this to see if this is the cause of the above error:

unset RUBYOPT && sudo env-update && gem -v

If this works without error you have a few options to get rid of this problem. I chose to pretty much nuke this nefarious environmental variable for good:

# Kill here

sudo rm /etc/env.d/10rubygems

# And here

sudo vim /etc/profile

unset RUBYOPT  # Add this line

# And just in case it creeps back in during an an update. Nuke it here too.

vim .zshrc

unset RUBYOPT  # Add this line

Now you should have your environment back in your own control. So go forth and set your own environmental variables for Ruby how you want em :-)

tags: gentoo, Ruby, rvm

Sat 18 Dec 2010, 00:35


Thanks a lot, that helped me!


Big thanks!




Thanks a lot, very usefull !


Thanks! It helped me!