gem executables will not run
jemiller1963 opened this issue · 2 comments
I am having an issue with gem executables.
I installed Ruby with Chruby but I am having issues with installing Foreman. I am getting the message:
[chat-stimulus] gem install foreman
WARNING: You don't have /Users/jem/.gem/ruby/2.6.0/bin in your PATH,
gem executables will not run.
Successfully installed foreman-0.87.2
1 gem installed
I put the output from my terminal into this gist. If you need more info, let me know and I will post.
https://gist.github.com/jemiller1963/25e45c4fe183cd9382a77f9073265fb7
Thanks!
What does which foreman
return? Definitely looks like foreman
was installed, but rubygems is complaining that the .gem/ruby/2.6.0/bin
directory ins't in PATH
(2.6.0 is the Ruby ABI version for 2.6.6p146, but chruby uses the exact RUBY_VERSION
string for the GEM_HOME
).
I'm saw this as well, so can add more details on what I observed:
After installing foreman
and seeing this warning, which foreman
returns foreman not found
.
which gem
returned ~/.rubies/ruby-2.6.10/bin/gem
~/.gem/ruby/
contained 2 directories:
2.6.0
contained theforeman
gem2.6.10
, which includes nothing but empty directories, except forcache/
which contains the cachedforeman
gem (?)
The difference for me was that I had installed using the --user-install
flag (set via a previous .gemrc configuration I had of course forgotten about...)
chruby
was correctly changing GEM_PATH
and GEM_HOME
, but these do not change the user_gemhome
that gem uses internally for resolving user installed gems. As far as I can tell, that is always set to the ruby ABI version in ~/.gem/ruby
, and I didn't find a separate environment var that allowed it to be overwritten.
To sum up:
- Gem was installed with
--user-install
- This put the gem into
~/.gem/ruby/<RUBY-ABI-VERSION>
instead of~/.gem/ruby/<RUBY_VERSION>
- Can debug this directly with
gem env
which clearly shows the 2 different paths being used.
chruby
behaviour could potentially be modified to add both of these to the path automatically when setting a ruby version to use. This would allow packages installed either way (gem install
or gem install --user-install
) to work as expected.