Installation to incorrect directory with chruby

I’ve followed the instructions listed here, but I’m having issues executing jekyll. This is due to the GEM not installing into the GEM_PATH as expected. See the information below.

➜  ~ chruby
 * ruby-3.1.3
➜  ~ gem env
RubyGems Environment:
  - RUBY VERSION: 3.1.3 (2022-11-24 patchlevel 185) [x86_64-darwin22]
  - INSTALLATION DIRECTORY: /Users/tnine/.gem/ruby/3.1.3
  - USER in DIRECTORY: /Users/tnine/.gem/ruby/3.1.0
  - RUBY EXECUTABLE: /Users/tnine/.rubies/ruby-3.1.3/bin/ruby
  - GIT EXECUTABLE: /usr/local/bin/git
  - EXECUTABLE DIRECTORY: /Users/tnine/.gem/ruby/3.1.3/bin
  - SPEC CACHE DIRECTORY: /Users/tnine/.gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: /Users/tnine/.rubies/ruby-3.1.3/etc
     - ruby
     - x86_64-darwin-22
     - /Users/tnine/.gem/ruby/3.1.3
     - /Users/tnine/.rubies/ruby-3.1.3/lib/ruby/gems/3.1.0
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
     - "install" => "--user --no-document"
     - "update" => "--user --no-document"
     - /usr/local/opt/scala@2.11/bin
     - /Users/tnine/.gem/ruby/3.1.3/bin
     - /Users/tnine/.rubies/ruby-3.1.3/lib/ruby/gems/3.1.0/bin
     - /Users/tnine/.rubies/ruby-3.1.3/bin
     - /usr/local/Cellar/pyenv-virtualenv/1.1.5/shims
     - /Users/tnine/.pyenv/shims
     - /Users/tnine/.pyenv/bin
     - /Applications/IntelliJ
     - /Users/tnine/.jenv/shims
     - /Users/tnine/.jenv/bin
     - /Users/tnine/develop/go/bin
     - /usr/local/bin
     - /System/Cryptexes/App/usr/bin
     - /usr/bin
     - /bin
     - /usr/sbin
     - /sbin
     - /Library/Apple/usr/bin
     - /Users/tnine/.gem/ruby/3.1.0/bin/
     - /Applications/Visual Studio
     - /usr/local/sbin
➜  ~ gem install jekyll
WARNING:  You don't have /Users/tnine/.gem/ruby/3.1.0/bin in your PATH,
	  gem executables will not run.
Successfully installed webrick-1.8.1
Successfully installed unicode-display_width-2.4.2
Successfully installed terminal-table-3.0.2
Successfully installed safe_yaml-1.0.5
Successfully installed rouge-4.1.0
Successfully installed forwardable-extended-2.6.0
Successfully installed pathutil-0.16.2
Successfully installed mercenary-0.4.0
Successfully installed liquid-4.0.4
Successfully installed kramdown-2.4.0
Successfully installed kramdown-parser-gfm-1.1.0
Building native extensions. This could take a while...

As you can see, jekyll is installing to the USER directory, not the INSTALLATION directory in the Gem env. Is this a bug, or is chruby not setting my path correctly? It seems to be setting it to the INSTALLATION value in my gem env. Note that my PATH contains the following directories.


Any idea what’s going on with my env? It’s been a while since I’ve used Ruby, so I’m unsure if the issue is with chruby, or the installation env value that jekyll is using.

Thanks in advance!

did you try adding the other path into your PATH?

maybe you have both ruby 3.1.0 and 3.1.3 installed? or maybe chruby is a ruby version manager? I’m not familiar with it.

I see lots of issues here where ruby is installed multiple times and uninstalling and re-installing seems to help.