Pasting text into IRB is incredibly slow. Readline issue?

一世执手 提交于 2019-12-04 23:53:40

This is an issue with Readline and UTF-8 terminals. I have not spent the time to track down where the real issue is coming from, however, if you set $LANG to some other value, the problem will disappear.

This isn't a permanent solution.

Another quick fix is to type an additional character after pasting text.

You could alternatively go back to using OSX' editline lib, if you recompiled ruby to not use Readline. Sadly this comes with it's own problems, such as the editline compatibility for rubys readline blocks threads.

I should also note that it's not just ruby that suffers this issue, I have seen it with other readline implementations on OSX since Snow Leopard.

maybe install pure ruby readline?

It looks like REE's installer.rb adds -I/opt/local/include and -L/opt/local/lib -Wl, linker flags. After clearing out those flags, REE compiles successfully without including the 2nd readline library, but the resultant ruby will not execute due to other load errors.

A solution is to temporarily remove MacPorts while installing REE so that it doesn't link to the extra readline library.

  1. Quit all processes that are accessing MacPorts files. You can see which ones are running with sudo lsof | grep /opt/local.
  2. sudo mv /opt/local /opt/localbak
  3. Open a new terminal, then compile and install REE
  4. sudo mv /opt/localbak /opt/local

After that, the REE installation will work properly alongside MacPorts.

Other solutions:

  • Uninstall MacPorts permanently, and install REE as usual
  • Use MRI or another version of Ruby instead of REE

edit: I've noticed that installing REE with ruby-build doesn't exhibit this problem

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!