문제

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.

도움이 되었습니까?

해결책

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
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top