I am using the chef-rvm cookbook by fnichol to perform a system wide installation of Ruby via RVM with the rvm::system recipe. I.e. In my run list, I have (with no additional attributes set):


After I cook my ubuntu server, everything works fine as a regular user. i.e.

$ ruby -v
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]

However, rvmsudo doesn't seem to preserve the RVM environment, or correctly pass it on to sudo. I get the following error:

$ rvmsudo ruby -v
sudo: ruby: command not found

How do I use chef to configure my environment so that rvmsudo has access to the ruby / gem environment?


This appears to be a problem with the current version of RVM itself (1.17.0), forcing an older version of RVM solves the issue. I did this by setting the following attributes:

node['rvm']['version'] = "1.16.13"
node['rvm']['branch'] = "none"
| improve this answer | |

You installed ruby only for your user. You should use rvm::system_install for system wide installation.

| improve this answer | |
  • Unfortunately this did not resolve the issue. From the documentation: This (recipe[rvm::system]) recipe includes default and system_install. So it would seem that I was already performing a system wide installation of RVM. system_install is used when I want to handle the installation of rubies myself. Not the case in this instance, happy to go with the default 1.9.3. – Clinton Nov 29 '12 at 0:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.