Home > feisty fawn, irb, linux, rails, ruby, ubuntu > How to make arrow keys working in irb in Linux/Ubuntu

How to make arrow keys working in irb in Linux/Ubuntu

July 11th, 2007

It was ruining all my mood and concentration when i was trying some sample ruby code in irb and again and again i had to retype the things because the arrow keys were not working there. I searched the problem on net and found that i need to have readline library on my linux and in ruby as well. Now the point is readline should be available on the linux before you compile ruby so as you can give the readline option while compiling ruby. BUT we have ruby already installed !! Now What ?

Now, first you will need to install system based readline libraries as

[source:ruby]
sudo apt-get install libreadline5 libreadline5-dev
[/source]

If you are not able to install linux based readline with the above method the refer this for more details.

Now you will need to compile the ruby based readline interface to let you readline library available in irb.
Do it by this…

[source:ruby]
cd /usr/local/src/ruby-1.8.6/ext/readline
sudo ruby extconf.rb
sudo make
sudo make install
[/source]

thats it, all done!!
Try your tips on arrow keys in irb, it should work now.
enjoy!!

sur feisty fawn, irb, linux, rails, ruby, ubuntu

  1. August 14th, 2007 at 01:20 | #1

    Hi

    Hey You are a ruby people and you are using php for your ruby site if we ruby people will not promote Ruby How will ruby SPREAD ?

  2. August 22nd, 2007 at 10:27 | #2

    Hey Jeet,

    I hope i will get time to switch on to Mephisto or else soon !

  3. October 11th, 2007 at 10:37 | #3

    Hi,

    Nice blog!

    Try http://www.rubyinside.com/wirble-tab-completion-and-syntax-coloring-for-irb-336.html for more cool stuff on IRB - output coloring and tab completion

    PS: I read that you are a .NET convert - dude, you’ve converted pretty well :) :) Maku

  4. October 11th, 2007 at 10:48 | #4

    Thanks Maku!!

    thats really useful gem for irb.

  5. KevinC
    October 15th, 2007 at 17:07 | #5

    Thanks for this post ! It saved me.

    Especially this line:
    sudo apt-get install libreadline5 libreadline5-dev

  1. No trackbacks yet.