Reputation: 186
I am using Ubuntu 12.10 and I am trying to get my project up and running using rbenv and bundler.
I have successfully installed rbenv from the apt repository and installed the required version of ruby using ruby-build.
When I run which gem
I get the global /usr/bin/gem
that I assume came with the apt repository install. However when I run rbenv which gem I get the proper local gem /home/kasuko/.rbenv/versions/1.9.2-p290/bin/gem
However when I run gem install bundler
I get an error on permissions with "Permission denied - /var/lib/gems" which leads me to believe that it is using the global gem.
So when I run /home/kasuko/.rbenv/versions/1.9.2-p290/bin/gem install bundler
it successfully installs bundler
I do have the rbenv init line in my ~/.zshrc.local (which is sourced in my ~/.zshrc)
and I get the updated path "/home/kasuko/.rbenv/shims:/home/kasuko/.bin:/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"
so I'm pretty sure it's installed correctly.
So why aren't my rbenv shims being used?
Thanks Kasuko
Upvotes: 2
Views: 1914
Reputation: 678
If you're not sure which gem
is being executed, try gem env
which will show you useful information about the version of gem
you're running, such as the rubygems version, corresponding ruby executable, gem paths and other good stuff.
Your PATH seems correct. Try running hash -r
to clear the shell's cache of executable paths just in case.
Once you've done this, which gem
should give you /home/kasuko/.rbenv/shims/gem
, which would indicate that it's deferring to rbenv to determine the actual executable to run.
You may then need to run rbenv rehash
. This should be run every time you install a new gem with an executable (like bundler, rake, etc). It will update all the shims to point to the correct executables.
Upvotes: 1