Project

General

Profile

Actions

Bug #21723

open

`binding.irb` raises a LoadError under `bundle exec`

Bug #21723: `binding.irb` raises a LoadError under `bundle exec`

Added by osyoyu (Daisuke Aritomo) about 3 hours ago.

Status:
Open
Assignee:
-
Target version:
-
ruby -v:
ruby 4.0.0preview2 (2025-11-17 master 4fa6e9938c) +PRISM [arm64-darwin24]
[ruby-core:123966]

Description

In Ruby 4.0, binding.irb raises a LoadError when some unknown condition is met.

# main.rb
binding.irb
main.rb:1: 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.
Failed to activate irb, please install it with 'gem install irb'
/Users/osyoyu/.rbenv/versions/master/lib/ruby/4.0.0+0/bundled_gems.rb:60:in 'Kernel.require': cannot load such file -- irb (LoadError)
Did you mean?  erb
        from /Users/osyoyu/.rbenv/versions/master/lib/ruby/4.0.0+0/bundled_gems.rb:60:in 'block (2 levels) in Kernel#replace_require'
        from main.rb:1:in 'Binding#irb'
        from main.rb:1:in '<main>'
/Users/osyoyu/.rbenv/versions/master/lib/ruby/4.0.0+0/bundled_gems.rb:60:in 'Kernel.require': cannot load such file -- irb (LoadError)
Did you mean?  erb
        from /Users/osyoyu/.rbenv/versions/master/lib/ruby/4.0.0+0/bundled_gems.rb:60:in 'block (2 levels) in Kernel#replace_require'
        from main.rb:1:in 'Binding#irb'
        from main.rb:1:in '<main>'

While irb has been changed to a bundle gem in #20309, it is agreed that binding.irb shall work under bundle exec without adding irb in Gemfile.
Thus, I've considered this behavior as an bug and created a ticket here.

One condition I have discovered is when the Gemfile contains a gem reference with a path: option.
I have created a repro repository in https://github.com/osyoyu/irbfail for that case.

No data to display

Actions

Also available in: PDF Atom