- Install Puppet from MSI
- Note that the Ruby install path is something like
c:\program files\puppet labs\puppet\sys\ruby
- Install Chocolatey in PowerShell with
iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))
- Close / re-open PowerShell
- Install Ruby Devkit -
choco install ruby2.devkit
- Add Ruby to the beginning of the PATH using an 8.3 style path -
$Env:PATH = "C:\Progra~1\Puppet~1\Puppet\sys\ruby\bin;" + $Env:PATH
(NOTE:dir /x
insidecmd.exe
can be helpful to find 8.3 style paths)- If done correctly
gem env
should contain a line withRUBY EXECUTABLE: C:/PROGRA~1/PUPPET~1/Puppet/sys/ruby/bin/ruby.exe
- This part is absolutely critical, so if
gem env
doesn't have a bunch of 8.3 style paths, you've done something wrong
- If done correctly
- Configure DevKit for use with our vendored Ruby
cd \DevKit-2.0-x64
ruby dk.rb init
to generateconfig.yml
- verify the generated
config.yml
and ensure that it has an entry for the vendored Ruby like below (and add it if it doesn't), then runruby dk.rb install
to associate the install with the devkit
---
- C:/progra~1/puppet~1/puppet/sys/ruby/bin
- Now gems with native code can be installed! Verify with
gem install pry
One of the artifacts of a broken DevKit install is a message like
Error “invalid switch in RUBYOPT: -F (RuntimeError)”
as described at http://stackoverflow.com/questions/16898286/error-invalid-switch-in-rubyopt-f-runtimeerror-is-shown-while-install-gems