SOLVED - Gem path discrepancy


(twoesplease) #1

Hi, my machine is having trouble finding installed local gems, and is looking in usr/local/Cellar for the gem file.

The gem shows as installed when I run gem list, but I get this error when attempting to run the ruby file that includes the gem:

/usr/local/Cellar/ruby/2.4.1_1/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:inrequire’: cannot load such file – /Users/user/lib/httparty (LoadError)
from /usr/local/Cellar/ruby/2.4.1_1/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in require'

Here is the output of gem environment:

` - RUBYGEMS VERSION: 2.6.11

  • RUBY VERSION: 2.4.1 (2017-03-22 patchlevel 111) [x86_64-darwin15]
  • INSTALLATION DIRECTORY: /Users/user/.gem/ruby/2.4.1
  • USER INSTALLATION DIRECTORY: /Users/user/.gem/ruby/2.4.0
  • RUBY EXECUTABLE: /usr/local/opt/ruby/bin/ruby
  • EXECUTABLE DIRECTORY: /Users/user/.gem/ruby/2.4.1/bin
  • SPEC CACHE DIRECTORY: /Users/user/.gem/specs
  • SYSTEM CONFIGURATION DIRECTORY: /usr/local/Cellar/ruby/2.4.1_1/etc
  • RUBYGEMS PLATFORMS:
    • ruby
    • x86_64-darwin-15
  • GEM PATHS:
    • /Users/user/.gem/ruby/2.4.1
  • GEM CONFIGURATION:
    • :update_sources => true
    • :verbose => true
    • :backtrace => false
    • :bulk_threshold => 1000
  • REMOTE SOURCES:
  • SHELL PATH:
    • /usr/local/bin
    • /usr/bin
    • /bin
    • /usr/sbin
    • /sbin`

Here are things I’ve tried so far, & I’m still getting the same error:

  • read a bunch of stack overflow articles
  • update my $PATH
  • uninstall and reinstall gems
  • uninstall rbenv
  • uninstall & reinstall ruby (via homebrew)
  • brew prune, brew unlink/link ruby, brew update, brew upgrade, brew doctor
  • uninstall & reinstall homebrew

Two things I notice that I think may be related to the issue are:

  1. The file path in the error shows that it’s looking for gems inside a ruby 2.4.0 directory that’s contained in the ruby 2.4.1 directory
  2. My gem environment shows the Cellar in the system configuration directory but not in the others

Any ideas, or links to other threads here that I should read?


(Mike McQuaid) #2

This bit is expected because 2.4.0 is the Ruby ABI version.

What’s the output of env | grep -Ei "(gem|ruby)"? Thanks!


(twoesplease) #3

Hi Mike,

Thanks for replying! That command didn’t output anything on my machine, but I was able to get things figured out with another uninstall/reinstall and some additional tweaks to my $PATH.


(Mike McQuaid) #4

Glad you got it sorted!