1

I am trying to use test-kitchen, a tool to test chef (etc) cookbooks with virtual machines. However when following the guide and doing kitchen init --driver=kitchen-vagrant, I get the following error:

      create  .kitchen.yml
      append  Rakefile
      create  test/integration/default
      append  .gitignore
      append  .gitignore
Fetching: kitchen-vagrant-0.15.0.gem (100%)
ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions into the /var/lib/gems/1.9.1 directory.

I am not running this as root. I am mostly a python programmer, and don't know much about the ruby ecosystem (and gem etc.). In python, with pip, you can use --user to install python packages to the user's home directory. Or use a virtualenv stored locally.

Other people have had similar problems, but the advise/accepted answer is sometimes to run this as root. I am not doing everything as root.

I am using Ubuntu Linux 14.04.1 trusty. I'd like to use vagrant for the VM (but I can change to another local VM system if needed).

Is there a standard method to install and use add-on Ruby gems from a user's home directory?

Amandasaurus
  • 31,471
  • 65
  • 192
  • 253

1 Answers1

1

It sounds like you've installed the "ruby" packages from Ubuntu, and installed test-kitchen as a rubygem. It is strongly recommended that for developing Chef cookbook code that you use ChefDK. Chef Software, Inc. creates native (deb) packages for ChefDK on several popular platforms for workstation use including Ubuntu Linux 14.04. There is also an apt repository that includes ChefDK if you'd prefer to download with apt-get.

The ChefDK includes chef, test-kitchen, and kitchen-vagrant, plus many other tools useful for Chef cookbook development. You can also use it as your default "system" ruby if Chef is all you need Ruby for on your system. If you do this be sure to uninstall the distribution's "ruby" package.

The motivation for having this package is because CHEF moves at a different rate for published software than distributions. Often, the newest version, or newer versions of Ruby/RubyGems aren't available on distribution package repositories, and between the various distros, they have wildly different release cycles. As a python programmer I am sure you can commiserate with this, given the variety of versions of python available on different distributions.

jtimberman
  • 7,587
  • 2
  • 34
  • 42