As the title says, when I run the Ruby interactive shell irb in a shell-mode buffer on MacOS, my input line is echoed back many times, character by successive character. Example:

irb(main):001> 1+1
irb(main):001> 1irb(main):001* 1+irb(main):001> 1+1irb(main):001> 1+1
=> 2

That's for just three input characters. More characters can produce an extremely long echo line.

This doesn't happen for other interactive shells, like Raku or Python. It also doesn't happen for irb if I run it in a non-Emacs terminal. It also doesn't happen for irb in an Emacs term terminal, which I just thought to check.

All I can find by searching for relevant terms is a phenomenon whereby the entire input line is echoed at once. I recently arranged to set the Emacs variable comint-process-echoes to t, but I don't recall exactly why I needed to. In any case, this variable has no effect on the kind of echoing I've described.

Any tips on investigating or addressing this weirdness?

1 Answer 1


This behavior comes with the latest versions of Irb which use Reline by default instead of libreadline.

See this issue for more details.

The solution is to invoke irb --nomultiline --nosingleline, to enable the simpler interaction mode. You might also want to try inf-ruby instead of running the REPL in shell-mode.

  • I saw the same echoing behavior in the inf-ruby buffer. The inf-ruby Github page mentions setting some irb configuration variables in ~/.irbrc, which also fixes the problem in shell-mode.
    – Sean
    Commented Apr 11 at 17:56
  • @Sean M-x inf-ruby should automatically detect whether these flags are required. Perhaps something new problem came up with some new release. You're welcome to file a bug for inf-ruby with your specific versions of ruby and irb, and I'll take a look.
    – Dmitry
    Commented Apr 11 at 22:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.