Frage

I would like to get the path of the gem directory for the current ruby (under rbenv).

This gives me the bin dir:

rbenv which ruby

which I could chop around and suite my needs, but I'd like to see if there is something more direct.

I'm thinking that

rbenv prefix

is the best choice. This leaves me with something like

/Users/newalexandria/.rbenv/versions/1.9.3-p448

to which I append

/lib/ruby/gems/1.9.1/gems

I'm worried about the gems version. Would like to see anything better.

War es hilfreich?

Lösung

rbenv exec gem environment returns information about your rubygems install.

Use it with grep to isolate the directory:

$ rbenv exec gem environment | grep INSTALLATION
> - INSTALLATION DIRECTORY: $HOME/.rbenv/versions/X.X.X-pX/lib/ruby/gems/X.X.X
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top