Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gem executables will not run #455

Open
jemiller1963 opened this issue Mar 21, 2021 · 2 comments
Open

gem executables will not run #455

jemiller1963 opened this issue Mar 21, 2021 · 2 comments
Assignees

Comments

@jemiller1963
Copy link

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!

@postmodern postmodern self-assigned this Sep 13, 2021
@postmodern
Copy link
Owner

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).

@cayleyh
Copy link

cayleyh commented Oct 6, 2023

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 the foreman gem
  • 2.6.10, which includes nothing but empty directories, except for cache/ which contains the cached foreman 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants