How to Install "Readline" for Rails Console

rails console doesn't load due to libreadline

Ran across this today, to solve it I did:

brew rm -f readline

brew install readline

brew link readline --force

Hope it helps.

EDIT: I recently ran into this problem again (after downgrading Ruby) since I wrote this, and I now prefer @califrench's solution from the comments below:

ln -s /usr/local/opt/readline/lib/libreadline.dylib /usr/local/opt/readline/lib/libreadline.7.dylib

Why do I get a Readline error when trying to start rails console?

Please read the output of:

rvm requirements

It will show you list of libraries you need to install to make good use of Ruby

After installing all the libs, clean rvm installed libs and reinstall Ruby:

rm -rf $rvm_path/usr
rvm reinstall 1.9.3

Problems with the rails console, RVM and readline

I had a similar problem it was with 1.9.2 on Ubuntu 10.04, but the symptoms were identical. In order to get it to work:

rvm pkg install readline

or prior to RVM version 1.6.32, you need the following command

rvm package install readline

Then:

apt-get install ncurses-dev

And then taking from their instructions at http://rvm.beginrescueend.com/packages/readline/

cd $HOME/.rvm/src/ruby-1.9.2-p0/ext/readline
ruby extconf.rb -- --with-readline-dir="$HOME/.rvm/usr"
make install

I had actually done a system rvm install on the server, so I needed to do this:

cd $HOME/.rvm/src/ruby-1.9.2-p0/ext/readline
ruby extconf.rb -- --with-readline-dir="/usr/local/rvm/usr"
make install

After that I was able to have full access to the console.

rails console require cannot load such file readline

Readline gem is required by your application but not specified in your Gemfile

Please add this to your gem file

gem 'rb-readline' 

Also reinstall

libreadline-dev


Related Topics



Leave a reply



Submit