Skip to content

Instantly share code, notes, and snippets.

@julik
Created August 24, 2011 13:10
Show Gist options
  • Save julik/1168024 to your computer and use it in GitHub Desktop.
Save julik/1168024 to your computer and use it in GitHub Desktop.
Decent Readline support for irb/pry on Leopard and above for decent UTF8 input, with RVM
Ensure that your ~/.inputrc contains this
set convert-meta off
set input-meta on
set output-meta on
Install the REAL GNU readline from source
$ curl ftp://ftp.cwru.edu/pub/bash/readline-6.2.tar.gz | tar xfz - && cd readline-6.2 && ./configure --enable-multibyte && make && sudo make install
or of using homebrew
$ brew install readline
You can also try the readline RVM package but I never tested whether it has it's multibyte flag on.
Then change the Ruby configure options in RVM
$ mate ~/.rvmrc
and add
export ruby_configure_flags="--with-readline-dir=/usr/local"
or, if using homebrew, to
export ruby_configure_flags="--with-readline-dir=/usr/local/Cellar/readline/x.x.x"
Rebuild your RVM rubies
$ rvm uninstall ruby-1.8.7-p330
$ rvm install ruby-1.8.7-p330
and so on for each ruby (meh). You could also try recompiling the readline extension for each of the installed rubies which will save you some compile time (again, repeat for each Ruby)
$ cd $HOME/.rvm/src/ruby-1.9.2-p0/ext/readline
$ ruby extconf.rb
$ make install
@julik
Copy link
Author

julik commented Aug 25, 2011

amended as requested

@chochkov
Copy link

chochkov commented Dec 2, 2011

Hey, I'm looking for a way to get vim editing mode working with pry/irb having set editing-mode vi in ~/.inputrc but in contrast to for example psql or R where this functions, it doesnt by pry/irb. I tried recompiling the ruby using the --with-readline-dir but it didnt work. Can u think of a way to get this working with PRY

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment