Puppet and Vim fighting over Ruby version

mac-osxpuppetrubyvim

I have installed puppet 3.0.1 from the .dmg from puppetlabs. If I remove ruby 1.9.3, puppet works, but other things like my vim install (dependant plugins) do not.

According to http://docs.puppetlabs.com/guides/platforms.html#ruby-versions 1.9.3 is supported. So whats going wrong with puppet?

% uname -a
Darwin Kusanagi.local 11.4.2 Darwin Kernel Version 11.4.2: Thu Aug 23 16:25:48 PDT 2012; root:xnu-1699.32.7~1/RELEASE_X86_64 x86_64

% which ruby
/usr/local/bin/ruby

% ruby --version
ruby 1.9.3p327 (2012-11-10 revision 37606) [x86_64-darwin11.4.2]

% /usr/bin/ruby --version
ruby 1.8.7 (2012-02-08 patchlevel 358) [universal-darwin11.0]

% brew info ruby                                                                                                                                    1 ↵
ruby: stable 1.9.3-p327, HEAD
http://www.ruby-lang.org/en/
Depends on: pkg-config, readline, gdbm, libyaml
/usr/local/Cellar/ruby/1.9.3-p327 (796 files, 17M) *
https://github.com/mxcl/homebrew/commits/master/Library/Formula/ruby.rb
==> Options
--with-tcltk
    Install with Tcl/Tk support
--with-suffix
    Suffix commands with "19"
--universal
    Build a universal binary
--with-doc
    Install documentation
==> Caveats
NOTE: By default, gem installed binaries will be placed into:
  /usr/local/Cellar/ruby/1.9.3-p327/bin

You may want to add this to your PATH.

% puppet
/usr/local/Cellar/ruby/1.9.3-p327/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- puppet/util/command_line (LoadError)
    from /usr/local/Cellar/ruby/1.9.3-p327/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from /usr/bin/puppet:3:in `<main>'

Best Answer

Here's Puppet's support matrix for ruby versions:

http://docs.puppetlabs.com/guides/platforms.html#ruby-versions

(UPDATE after OP updated to show error messages)

Puppet has installed itself into your system Ruby library location under /usr/lib/ruby/1.8/site_ruby/, which the homebrew ruby will not look at.

The top line of /usr/bin/puppet is #!/usr/bin/env ruby which runs the first ruby in your $PATH. So you can either adjust your $PATH variable or change that line to specifically run the system ruby, a'la:

#!/usr/bin/ruby

Related Topic