Recently I tried to paste some unicode characters into my
irb session, but was greeted with the following:
irb(main):001:0> utf8_str = "r\U+FFC3\U+FFA9sum\U+FFC3\U+FFA9"
That's not what I expected! After some intrepid googling, this article by Henrik Nyh says the default OS X
libedit library that Ruby is compiled against doesn't have good unicode support.
$ cd ~/.rbenv/versions/1.9.3-p374/lib/ruby/1.9.1/x86_64-darwin12.2.0 $ otool -L readline.bundle readline.bundle: /usr/lib/libedit.3.dylib (compatibility version 2.0.0, current version 3.0.0)
Let's fix that. Update homebrew and install the latest
$ brew update && brew install readline
Then, recompile ruby by manually setting the path to
readline using the
CONFIGURE_OPTS environment variable:
CONFIGURE_OPTS=--with-readline-dir=`brew --prefix readline` rbenv install 1.9.3-p374
We can confirm
readline was linked by running
$ otool -L readline.bundle readline.bundle: /usr/local/opt/readline/lib/libreadline.6.2.dylib (compatibility version 6.0.0, current version 6.2.0)