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
no such file to load -- readline
The readline module is normally part of the Ruby package itself.
Did you manually build your Ruby install? If so, you want to make sure libreadline and its headers are installed, and build again.
On Debian/Ubuntu:
apt-get install libreadline-dev
Or on RHEL/CentOS, try
yum install readline-devel
Update:
You are using a very old release of Ubuntu. If you want to keep using it, open /etc/apt/sources.list
in a text editor, and change all occurrences of archive.ubuntu.com
to old-releases.ubuntu.com
. Then, run apt-get update
and try the above again.
I urge you to consider updating your installation, though. Ubuntu 7.10 hasn't seen security updates in quite a while, and using it in production is not recommended. Even if it's not a production machine, there's a good chance you'll run into further problems because of old versions of certain libraries/dependencies.
no such file to load -- readline (Load Error)
I must check rvm requirements
and ensure that all packages were installed.
Then reintall ruby:
rvm reinstall 1.9.2
Removing /usr/local/rvm/src/ruby-1.9.2-p318...
Removing /usr/local/rvm/rubies/ruby-1.9.2-p318...
Removing default ruby interpreter
Removing ruby-1.9.2-p318 aliases...
Removing ruby-1.9.2-p318 wrappers...
Removing ruby-1.9.2-p318 environments...
Removing ruby-1.9.2-p318 binaries...
Installing Ruby from source to: /usr/local/rvm/rubies/ruby-1.9.2-p318, this may take a while depending on your cpu(s)...
ruby-1.9.2-p318 - #fetching
ruby-1.9.2-p318 - #extracting ruby-1.9.2-p318 to /usr/local/rvm/src/ruby-1.9.2-p318
ruby-1.9.2-p318 - #extracted to /usr/local/rvm/src/ruby-1.9.2-p318
ruby-1.9.2-p318 - #configuring
ruby-1.9.2-p318 - #compiling
ruby-1.9.2-p318 - #installing
Removing old Rubygems files...
Installing rubygems-1.8.18 for ruby-1.9.2-p318 ...
Installation of rubygems completed successfully.
ruby-1.9.2-p318 - adjusting #shebangs for (gem irb erb ri rdoc testrb rake).
ruby-1.9.2-p318 - #importing default gemsets (/usr/local/rvm/gemsets/)
Install of ruby-1.9.2-p318 - #complete
And finally it works:
$ script/rails c
DEPRECATION WARNING: railtie_name is deprecated and has no effect. (called from <top (required)> at /home/israel/proyectos/d-Formacion/config/application.rb:7)
/usr/local/rvm/gems/ruby-1.9.2-p318/gems/actionpack-3.0.4/lib/action_dispatch/http/mime_type.rb:98: warning: already initialized constant PDF
Loading development environment (Rails 3.0.4)
1.9.2-p318 :001 > exit
Why does Rails console say cannot load such file -- readline ?
You need to have the readline libraries installed when you compile Ruby.
If you are on CentOS/Redhat/Fedora Linux, install the package using:
sudo yum install readline-devel
Or, on Ubuntu, use:
sudo apt-get install libreadline6 libreadline6-dev
and then recompile Ruby.
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
Related Topics
Ruby - Net/Http - Following Redirects
How to Avoid Nomethoderror For Nil Elements When Accessing Nested Hashes
Nokogiri Gem Installation Error
Cannot Use Rvm-Installed Ruby With Sudo
Total Newbie: Instance Variables in Ruby
How to Update Ruby to 1.9.X on Mac
Confirmation About Pgrep Returning Itself
In Ruby Why Won't 'Foo = True Unless Defined(Foo)' Make the Assignment
Ruby: How to Turn a Hash into Http Parameters
Why Is Sum So Much Faster Than Inject(:+)
No Such File to Load - Readline
Heroku Not Sending Email With Gmail Smtp
How to Use "Gets" and "Gets.Chomp" in Ruby
Rails: Skinny Controller Vs. Fat Model, or Should I Make My Controller Anorexic
Split the String to Get Only the First 5 Characters
Nokogiri Will Not Install - Error: Failed to Build Gem Native Extension