Ever have a problem with the wrong gem loading or the gem you’re expecting not being found?
You can use the gem environment
command to output various information about the RubyGems environment:
❯ gem environment
RubyGems Environment:
- RUBYGEMS VERSION: 3.3.27
- RUBY VERSION: 3.1.6 (2024-05-29 patchlevel 260) [arm64-darwin23]
- INSTALLATION DIRECTORY: /Users/powell/.rbenv/versions/3.1.6/lib/ruby/gems/3.1.0
- USER INSTALLATION DIRECTORY: /Users/powell/.gem/ruby/3.1.0
- RUBY EXECUTABLE: /Users/powell/.rbenv/versions/3.1.6/bin/ruby
- GIT EXECUTABLE: /usr/bin/git
- EXECUTABLE DIRECTORY: /Users/powell/.rbenv/versions/3.1.6/bin
- SPEC CACHE DIRECTORY: /Users/powell/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /Users/powell/.rbenv/versions/3.1.6/etc
- RUBYGEMS PLATFORMS:
- ruby
- arm64-darwin-23
- GEM PATHS:
- /Users/powell/.rbenv/versions/3.1.6/lib/ruby/gems/3.1.0
- /Users/powell/.gem/ruby/3.1.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => true
- :bulk_threshold => 1000
- :ssl_verify_mode => 1
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /Users/powell/.rbenv/versions/3.1.6/bin
- /opt/homebrew/Cellar/rbenv/1.3.0/libexec
- /Users/powell/.rbenv/plugins/ruby-build/bin
...
- /usr/bin
- /bin
- /usr/sbin
- /sbin
If you export GEM_PATH=/path:/path2...
those paths will be added to the GEM
- GEM PATHS:
- /Users/powell/.rbenv/versions/3.1.6/lib/ruby/gems/3.1.0
- /Users/powell/.gem/ruby/3.1.0
- /path
- /path2
You can also see the remote sources, and the gem configuration including ssl_verify_mode
and other settings. (See Gem::ConfigFile
)