Read more

Understanding IRB warning "can't alias ... from ..."

Dominik Schöler
April 06, 2018Software engineer at makandra GmbH

Sometimes, the IRB prints a warning during boot:

irb: warn: can't alias source from irb_source.

Explanation

Illustration online protection

Rails Long Term Support

Rails LTS provides security patches for old versions of Ruby on Rails (2.3, 3.2, 4.2 and 5.2)

  • Prevents you from data breaches and liability risks
  • Upgrade at your own pace
  • Works with modern Rubies
Read more Show archive.org snapshot

During boot, the IRB creates many aliases Show archive.org snapshot to give the user quick access to irb functions like source-ing a file.

However, if IRB's context already responds to the alias it wants to create Show archive.org snapshot , it will not overwrite the method with its alias and print the above warning instead.

This may happen especially when invoking IRB programmatically, e.g. in Spreewald Show archive.org snapshot .

Solution

A workaround is to undef the method IRB complains about Show archive.org snapshot , prior to IRB initialization.

If this is not feasible, e.g. because you depend on the method, you can try to patch IRB, e.g. by modifying the EXTEND_COMMANDS or overriding this method Show archive.org snapshot .

Posted by Dominik Schöler to makandra dev (2018-04-06 11:36)