rbenv: cannot find `--user-install`d gem executable
I have the following ruby versions installed via rbenv, 2.0.0-p648, 2.6.3 and 2.6.5 which both 2.6 versions have rubocop installed:
Results when using 2.6.3:
$ rbenv versions
system
2.0.0-p648
* 2.6.3 (set by /Users/longspell/.ruby-version)
2.6.5
$ gem info rubocop
*** LOCAL GEMS ***
rubocop (0.80.1, 0.75.1)
Authors: Bozhidar Batsov, Jonas Arvidsson, Yuji Nakayama
Homepage: https://github.com/rubocop-hq/rubocop
License: MIT
Installed at (0.80.1): /Users/longspell/.gem/ruby/2.6.0
(0.75.1): /Users/longspell/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0
Automatic Ruby code style checking tool.
$ rubocop --version
0.80.1
Results when using 2.6.5:
$ rbenv versions
system
2.0.0-p648
2.6.3
* 2.6.5 (set by /Users/longspell/test/.ruby-version)
$ gem info rubocop
Ignoring byebug-11.1.1 because its extensions are not built. Try: gem pristine byebug --version 11.1.1
Ignoring io-console-0.5.6 because its extensions are not built. Try: gem pristine io-console --version 0.5.6
*** LOCAL GEMS ***
rubocop (0.80.1)
Authors: Bozhidar Batsov, Jonas Arvidsson, Yuji Nakayama
Homepage: https://github.com/rubocop-hq/rubocop
License: MIT
Installed at: /Users/longspell/.gem/ruby/2.6.0
Automatic Ruby code style checking tool.
$ rbenv rehash
$ rubocop --version
rbenv: rubocop: command not found
The `rubocop' command exists in these Ruby versions:
2.6.3
Same results for solargraph. Seems to be trying to use the ~/.rbenv/versions bin instead of the ~/.gems bin path. This happens even if I am on 2.6.5 and do gem install rubocop. I’ve even gone so far as to gem uninstall rubocop and remove all versions from 2.6.3, but upon gem install rubocop && rbenv rehash in 2.6.5 I’m still told rubocop only exists in 2.6.3.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 15 (4 by maintainers)
Full disclosure, I had a long forgotten
~/.gemrcthat was setting my gem installs to the user space. 😑Thanks for the cordial responses and looking into this.
OK, it looks like my problem was caused by installing the Homebrew version of Tmuxinator, which installs a full version of Ruby with it:
So I think there was some confusion between the Homebrew and Rbenv versions of Ruby 2.7.1. Uninstalling Tmuxinator and Ruby (
brew uninstall tmuxinator ruby) wasn’t enough to fix it—if I reinstalled 2.7.1 using Rbenv, it would still show up inbrew list. So I uninstalled Homebrew entirely and am now reinstalling everything. If that doesn’t work I’ll update this.