LoadError when using bundle exec to run a script in Ruby 3 (using rvm)

The following Ruby script gives me a LoadError when it requires the activesupport gem, but everything else is showing me that it's installed. I get the same error whether I run it through bundle exec or rvm do.

$ cat Gemfile | grep activesupport
gem 'activesupport'

$ bundle show activesupport

$ bundle exec ruby my_ruby_script.rb
Can I find the gem?
#<Bundler::StubSpecification name=activesupport version=7.0.6 platform=ruby>
Can I require the gem?
my_ruby_script.rb:4:in `require': cannot load such file -- activesupport (LoadError)
    from my_ruby_script.rb:4:in `<main>'


puts 'Can I find the gem?'
puts Gem::Specification.find_all{ |g| 'activesupport' }
puts 'Can I require the gem?'
require 'activesupport'


  • rvm 1.29.12
  • ruby 3.1.2p20
  • gem 3.3.7
  • bundle 2.3.7
  • macOS 13.5.2 (M2)


  • The gem has to be loaded like this (note the underscore):

    require "active_support"

    Read about Stand-Alone Active Support in the Rails Guides.