Skip to content

Add irb as a development dependency - #1832

Open
sngsmz wants to merge 1 commit into
thoughtbot:mainfrom
sngsmz:add-irb-dev-dependency
Open

Add irb as a development dependency#1832
sngsmz wants to merge 1 commit into
thoughtbot:mainfrom
sngsmz:add-irb-dev-dependency

Conversation

@sngsmz

@sngsmz sngsmz commented Aug 5, 2026

Copy link
Copy Markdown

Summary

  • Add irb as a development dependency so bin/console works on Ruby 4.0+.
  • Since Ruby 4.0, irb is no longer part of the default gems. bin/console requires irb after bundler/setup, so without declaring it in the gemspec, starting the developer console fails with: bin/console:
    • warning: irb used to be loaded from the standard library, but is not part of the default gems since Ruby 4.0.0. You can add irb to your Gemfile or gemspec to fix this error. ... cannot load such file -- irb (LoadError)

Execution history

Before

$ bin/setup 

bundle install
+ bundle install
Bundle complete! 14 Gemfile dependencies, 72 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
$ bin/console
bin/console:12: warning: irb used to be loaded from the standard library, but is not part of the default gems since Ruby 4.0.0.
You can add irb to your Gemfile or gemspec to fix this error.
/Users/shingo.shimizu/.rbenv/versions/4.0.5/lib/ruby/4.0.0/bundled_gems.rb:60:in 'Kernel.require': cannot load such file -- irb (LoadError)
Did you mean?  erb
        from /Users/shingo.shimizu/.rbenv/versions/4.0.5/lib/ruby/4.0.0/bundled_gems.rb:60:in 'block (2 levels) in Kernel#replace_require'
        from bin/console:12:in '<main>'

After

$ bin/setup

bundle install
+ bundle install
Bundle complete! 15 Gemfile dependencies, 83 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
$ bin/console
irb(main):001> 

Changes

  • Add s.add_development_dependency("irb") to factory_bot.gemspec (alphabetically with other development dependencies)
  • Update Gemfile.lock accordingly

Test plan

  • bundle exec rake (unit + acceptance + cucumber + standard)
  • bin/console starts successfully on Ruby 4.0.5 (2026-05-20 revision 64336ffd0e)

Ruby 4.0 no longer ships irb as a default gem, so bin/console fails with a LoadError unless irb is declared for development.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant