Reputation: 1397
I want to use rbenv for setting ruby versions on a project per project basis. Otherwise, I want to use my default system ruby setup for everything else.
The problem I am having is the even though rbenv version
returns system
, gem
command still uses the rbenv shim (.rbenv/shims/gem
). So when I do gem environment
my INSTALLATION DIRECTORY is '/Library/Ruby/Gems/1.8'
. I would rather it remains ~/.gem/
. I can see it still is that when I run /usr/bin/gem enviroment
. I can't figure out where the rbenv shim gem is getting its settings from.
I've tried modifying my GEM_HOME both in my shell, and changing it in ~/.gemrc
but that has no effect. I've been searching around with no luck. Hopefully someone here can help. Just some pointers to where the rbenv gem shim is pulling its values from would be helpful.
thanks
Upvotes: 3
Views: 935
Reputation: 15199
Since rbenv shims are pretty high in your PATH, their purpose is to intercept any invocation of ruby
, gem
, and similar, even if the currently selected Ruby version is "system". You shouldn't be worried about that.
Now, the default installation path for your system Ruby will always be /Library/Ruby/Gems/1.8
. Here's my RBENV_VERSION=system gem env
:
- GEM PATHS:
- /Library/Ruby/Gems/1.8
- /Users/mislav/.gem/ruby/1.8
- /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8
However, if you don't use sudo
(and you shouldn't), gem install
won't have write access to that directory, and will install the gems in the next writeable path, which is ~/.gem/ruby/1.8
. That seems to be the behavior you want.
Upvotes: 5