Gem install using chef still picks the older ruby version


#1

‘which ruby’ returns me the latest ruby version installed which is 2.2.3.
‘which -a ruby’ returns 2 paths. one is 1.9

But the latest one is set as the default ruby for executing my chef recipe. But still when I execute a gem install using chef it takes the older version of ruby (1.9) and gives an error
‘rake requires Ruby version >= 2.0.0.’

Any idea why is this ?


#2

Hello @meeramarygeorge ,

The good practice is to have control over the versions, so I recommend you to:

  1. Install RVM (Ruby Version Manager):
    https://rvm.io/rvm/install

  2. Switch to the proper Ruby version:
    https://rvm.io/rubies/default

  3. Try to install the gem again.

Good luck!