Ruby Gem Management

Ruby gems are Ruby programs and libraries with a name, version and the platform that can execute them.

List the installed gems on your system

gem list

Detailed list that includes the author, homepage, license, install location and a short description

gem list -d

Install the latest version of the gem

gem install GEM_NAME

Install a specific version of the Gem

gem install GEM_NAME -v GEM_VERSION

Uninstall the gem from your system

gem uninstall GEM_NAME

Uninstall a  gem from a specific location


Update the Gem list in your system after Gem uninstallation

gem update --system





Undefined method or attribute error in a Chef recipe

There are multiple reasons Chef can display the following error message

 Undefined method or attribute `...' on `node'


There are multiple ways to reference an attribute in a Chef recipe:

node['ATTRIBUTE_NAME'] (the recommended way)
node[:ATTRIBUTE_NAME]  ( use it only if the single or double quotes (' or ") would cause a problem in the expression)


To check if the attribute value is nil, use the following format:

if ( !node['ATTRIBUTE_NAME'].nil? )

If you use the node.ATTRIBUTE_NAME format and the value is nil Chef throws the above error message.