[DRE-maint] Bug#649775: Bug#649775: rbenv: Does not work with non-root installed gems

Brandon Simmons brandon.m.simmons at gmail.com
Tue Nov 29 15:53:33 UTC 2011


On Mon, Nov 28, 2011 at 4:22 PM, Antonio Terceiro <terceiro at debian.org> wrote:
> Brandon Simmons escreveu isso aí:
>> I'm sorry, it actually seems like I'm not getting shims set up even
>> when I install the passenger gem as root and then run 'rehash':
>>
>>     $ ls ~/.rbenv/versions/1.8.7-debian/bin
>>     erb  gem  irb  rdoc  ri  ruby  testrb
>>     $ ls ~/.rbenv/shims
>>     erb  gem  irb  rdoc  ri  ruby  testrb
>>
>> looks like the passenger binaries ended up in /usr/local/bin. That
>> doesn't seem right, since if I gem install passenger in ruby 1.9 that
>> binary will be clobbered, right?
>
> Right. That's a limitation of having a system-wide rubygems installing
> binaries in the $PATH. There's even an open bug about that (#637914)

Thanks for clearing that up.

>
>> All of the shims that were set up for me are in /usr/bin
>
> The problem you are reporting is a limitation in rbenv-alternatives, I
> think.  rbenv expects the gem binaries to be installed in
> ~/.rbenv/versions/${version}/bin, and that's what happens when you use
> rbenv with Ruby versions compiled by hand with
> --prefix=$HOME/.rbenv/version/${version}, but not when you use a
> system-installed ruby whose binaries were only symlinked into
> ~/.rbenv/versions/${version}/bin
>
> One solution for that would be to make rbenv-alternatives create a `gem`
> script in ~/.rbenv/versions/${version}/bin that overrides GEM_HOME and
> calls the actual gem binary, instead of just creating a symlink.
>
> For now, you can workaround this doing what I do, which is using `gem
> install --user-install` plus something like this on my .bashrc:
>
>  eval "$(rbenv init -)"
>  # [...]
>  if which ruby >/dev/null && which gem >/dev/null; then
>    PATH="$(ruby -rubygems -e 'puts Gem.user_dir')/bin:$PATH"
>  fi

This is a fine solution for me, thanks. I think I have a better idea
of what all the moving parts are doing now. Could this note make it
into the README.debian? Also, for zsh users I put the lines above into
my ~/.zshenv file.

Thanks for your help and your excellent work on debian.

Brandon

>
> --
> Antonio Terceiro <terceiro at debian.org>
>





More information about the Pkg-ruby-extras-maintainers mailing list