I have chef 11.4.4 which has ruby 1.9.1 installed. I want to install berkshelf but it requires ruby 1.9.2 or later. I installed ruby 2.0.0-p247 (latest stable) with rvm. When i run a knife command I get ...
# knife help
/opt/chef/embedded/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs': Could not find chef (>= 0) amongst [rake-10.1.0, rvm-1.11.3.8] (Gem::LoadError)
from /opt/chef/embedded/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:256:in `to_spec'
from /opt/chef/embedded/lib/ruby/site_ruby/1.9.1/rubygems.rb:1231:in `gem'
from /usr/bin/knife:22:in `<main>'
If I switch it back to the system version, which is the version of ruby embedded with chef, it works again.
# rvm use system
Now using system ruby.
# knife help
Usage: knife SUBCOMMAND (options)
.
.
.
I've googled around for ways to upgrade ruby to 2.0.0x for chef but no luck. I like the ability to switch ruby versions so easily. It would be great if chef could do the same but just getting it to work with the latest stable or even 1.9.2 version of ruby would be great. Thanks!
You need to use a ruby with rvm:
rvm use 2.0.0-p247
this will set up environment to use that ruby, you can set it default for new shells/sessions with:
rvm alias create default 2.0.0 #OR:
rvm use 2.0.0 --default
It is also required to install the gems again as you switch to new ruby:
gem install chef
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With