Installing Inspec for RubyGems on Windows

I came across this as I was trying to install inspec to run against some Packer builds. The Github documentation only covers how to install inspec, and not the pre-requisites.

You likely experienced an error such as “[…] requires installed build tools” and you may try to run gem install buildtools

However, What you need to do is download the Ruby developer kit from https://rubyinstaller.org/downloads/ (found at the bottom of the page). You can unzip this wherever you like (I unzipped it to my Ruby install directory in a folder called devkit). From there, press SHIFT and right click, to open a command prompt window at that location. Now type:

ruby dk.rb init

and

ruby dk.rb install

The full output for these commands is below:

C:\Ruby23\devkit>ruby dk.rb init
[INFO] found RubyInstaller v2.3.3 at C:/Ruby23

Initialization complete! Please review and modify the auto-generated
'config.yml' file to ensure it contains the root directories to all
of the installed Rubies you want enhanced by the DevKit.

C:\Ruby23\devkit>ruby dk.rb install
[INFO] Installing 'C:/Ruby23/lib/ruby/site_ruby/2.3.0/rubygems/defaults/operating_system.rb'
[INFO] Installing 'C:/Ruby23/lib/ruby/site_ruby/devkit.rb'

Now, you can go ahead and

gem install inspec

Which will begin the installation.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Verified by MonsterInsights