Holger Bille
Holger Bille

Reputation: 2551

Ruby gems install vs. runtime path on OSX

Where's the mismatch between gem install path and used Rakefile path?

I originally wanted to run a Rakefile on my Mac OS X Mountain Lion 10.8.4. That failed on a missing 'open4' package.

I have no experience with ruby and little with Mac, but I googled open4 and found:

gem install open4

That also failed, but with sudo it succeeded.

It still didn't work though and my conclusion is that the install path:

/Library/Ruby/Gems/1.8

is different from the runtime include path, which I dumped from the script:

/Library/Ruby/Site/1.8
/Library/Ruby/Site/1.8/powerpc-darwin12.0
/Library/Ruby/Site/1.8/universal-darwin12.0
/Library/Ruby/Site
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/vendor_ruby/1.8
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/vendor_ruby/1.8/universal-darwin12.0
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/vendor_ruby
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/powerpc-darwin12.0
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin12.0

More googling led me to stackoverflow understanding-rubys-load-paths and more. They all seem to conclude the solution is RVM (links to RVM were broken)

I installed that:

sudo curl -L https://get.rvm.io | bash

But the path used by RVM was no better:

$ rvm gemdir
/Library/Ruby/Gems/1.8

A very old question - gem-path-used-by-rake-different-than-system-path-on-os-x seems to cover what I want to know, but the solution doesn't seem relevant on current OSX

Where's the mismatch between install and used path?

Upvotes: 2

Views: 2873

Answers (1)

mpapis
mpapis

Reputation: 53188

you need to use an rvm ruby:

rvm use ruby --install --default

Upvotes: 3

Related Questions