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.
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
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
Rails Console Not Loading
It could be that there are multiple versions of readline installed.
Try the following:
brew link readline --force
Related Topics
How to Reference a Function in Ruby
Iterate Over a Deeply Nested Level of Hashes in Ruby
Ruby: How to Add "# Encoding: Utf-8" Automatically
Couldn't Require Openssl in Ruby
How to Detect Certain Unicode Characters in a String in Ruby
Ruby on Rails - Drop Down Box on Change Event
How to Know When to "Refresh" My Model Object in Rails
Why Is _File_ Uppercase and _Dir_ Lowercase
How to Find the Namespace/Module Name Programmatically in Ruby on Rails
Guard with Rspec on Rails 4 Giving a Lot of Warnings
Strange Inability to Require Config/Boot After Upgrading to Ruby 1.9.2
Colon (:) Appears as Forward Slash (/) When Creating File Name
How to Run a Ruby Script Using Rbenv with Cron
Flattening Nested Hash to a Single Hash with Ruby/Rails
How to Require Active Record Working Outside of Rails
Size, Length and Count in Rails