How to use rvm (ruby version manager) with root account?

Jade picture Jade · Apr 11, 2010 · Viewed 18.8k times · Source

The whole point of rvm is to be able to install multiple rubies and access them from a user account. What do you do when you need to access any of those rubies from root? Or use gems installed in one of those rvms?

Is there an elegant (or even hackish) way to use these I haven't considered?

My guess is that I should just add it to my PATH, but I'm curious if anyone has come up with a better idea. I'd rather not install rvm just for the root account and duplicate everything.

Answer

Jade picture Jade · Apr 13, 2010

I found the solution:

rvmsudo does the trick.