Fixing readline for the Ruby on Rails console
Fixing readline for the Ruby on Rails console
First you need to install libreadline5 and libncurses5. I can't see why ncurses would be needed, but I am too lazy to uninstall it and check if it still works without the library. Using Apt on Ubuntu/Debian:
Next you want to go configure and rebuild Ruby's readline extension. I am using RVM and so Ruby exists in ~/.rvm/src/ruby-1.9.2-p180/ for me. This can differ for you but running which ruby should tell you where yours is.
$ rails console /home/user/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/irb/completion.rb:9:in `require': no such file to load -- readline (LoadError) from /home/user/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/irb/completion.rb:9:in `The problem is that Ruby is somehow not cofigured to load the readline library and thus cannot run its console. This is a downside of using a language specific package manager, seperate from your operating system's package manager.' from /home/ user/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.9/lib/rails/commands/console.rb:3:in `require' from /home/ user/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.9/lib/rails/commands/console.rb:3:in ` user' from /home/ user /.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.9/lib/rails/commands.rb:20:in `require' from /home/ /.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.9/lib/rails/commands.rb:20:in ` ' from script/rails:6:in `require' from script/rails:6:in ` '
First you need to install libreadline5 and libncurses5. I can't see why ncurses would be needed, but I am too lazy to uninstall it and check if it still works without the library. Using Apt on Ubuntu/Debian:
$ sudoaptitudeinstall libreadline5-dev libncurses5-dev
Next you want to go configure and rebuild Ruby's readline extension. I am using RVM and so Ruby exists in ~/.rvm/src/ruby-1.9.2-p180/ for me. This can differ for you but running which ruby should tell you where yours is.
cd ~/.rvm/src/ruby-1.9.2-p180/ext/readline ruby extconf.rb make make installDepending on your setup you might need to install it by running sudo make install instead. That is it! Now Ruby on Rails' console should load as intended.
Comments
Post a Comment