rails: rails c doesn't start the rails console.
I am not able to load the rails console.
$ ruby -v
ruby 2.2.4p230 (2015-12-16 revision 53155) [x86_64-darwin15]
~/opensource/intranet(master)*$ rails -v
Rails 4.2.0
$ rails s
=> Booting Thin
=> Rails 4.2.0 application starting in development on http://localhost:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
Thin web server (v1.6.2 codename Doc Brown)
Maximum connections set to 1024
Listening on localhost:3000, CTRL+C to stop
^CStopping ...
Exiting
$ rails c
/Users/prasad/.rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/irb/completion.rb:9:in `require': dlopen(/Users/prasad/.rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/x86_64-darwin15/readline.bundle, 9): Library not loaded: /usr/local/opt/readline/lib/libreadline.6.dylib (LoadError)
Referenced from: /Users/prasad/.rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/x86_64-darwin15/readline.bundle
Reason: image not found - /Users/prasad/.rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/x86_64-darwin15/readline.bundle
from /Users/prasad/.rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/irb/completion.rb:9:in `<top (required)>'
from /Users/prasad/.rvm/gems/ruby-2.2.4/gems/railties-4.2.0/lib/rails/commands/console.rb:3:in `require'
from /Users/prasad/.rvm/gems/ruby-2.2.4/gems/railties-4.2.0/lib/rails/commands/console.rb:3:in `<top (required)>'
from /Users/prasad/.rvm/gems/ruby-2.2.4/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:123:in `require'
from /Users/prasad/.rvm/gems/ruby-2.2.4/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:123:in `require_command!'
from /Users/prasad/.rvm/gems/ruby-2.2.4/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:58:in `console'
from /Users/prasad/.rvm/gems/ruby-2.2.4/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from /Users/prasad/.rvm/gems/ruby-2.2.4/gems/railties-4.2.0/lib/rails/commands.rb:17:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
Expected behaviour
Rails console should be loaded for rails c
Actual behaviour
Rails console doesnt load on rails c.
System configuration
Rails version: 4.2.0 Ruby version: 2.2.4p230 (2015-12-16 revision 53155) [x86_64-darwin15]
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 3
- Comments: 44 (4 by maintainers)
Commits related to this issue
- Add rb-readline gem to development requirements When I tried to run `bin/rails console` locally for the first time, I received an error about readline. Based on this comment (https://github.com/rails... — committed to neagle/gocongress by neagle 6 years ago
- added readline gem -added "rb-readline" gem to ensure can open the Rails Console (using "rails console"). --fixes an issue where the Rails Console fails to open on Mac. See https://github.com/rails/r... — committed to JLSJ-rummage-sale/volunteer-time-recorder by timhdavis 6 years ago
- This fixes the issue related to readline tool. https://github.com/rails/rails/issues/26658#issuecomment-255590071 — committed to bitzesty/qae by mechanicles 5 years ago
works for me:
ln -s /usr/local/opt/readline/lib/libreadline.7.0.dylib /usr/local/opt/readline/lib/libreadline.6.dylib
16/01/2019 @saxxi upd:
ln -s /usr/local/opt/readline/lib/libreadline.8.0.dylib /usr/local/opt/readline/lib/libreadline.7.dylib
Add ‘rb-readline’ gem to your Gemfile in development group and install it. It’s the easiest solution for silly “readline” errors. Other solutions didn’t work for me. 😦
Fyi @LegaKh’s solution still applies, I had to do:
My case, sidekiq wouldn’t start.
ruby
installed viarbenv
(rbenv-build
)readline
installed viabrew
(Homebrew)I unwisely did a
brew update
which changed myreadline
installation to one that myruby
install was not compiled with.My steps to correction: Note: for good measure, I rehashed rbenv
rbenv rehash
and started a new terminal session after just about every step.rbenv uninstall 2.2.0
brew install readline
RUBY_CONFIGURE_OPTS=--with-readline-dir="$(brew --prefix readline)" rbenv install 2.2.0
_More on this: https://github.com/rbenv/ruby-build/wiki_gem install bundler
bundle
Just reinstall your current ruby version, worked for me on ruby 2.1.2
This is not an issue related to Rails. See how to solve issues with rvm and readline. You will face this issue with any other gem which tries to use readline as well as the issue with your Ruby installation.
Thanks!
ln -s /usr/local/opt/readline/lib/libreadline.8.0.dylib /usr/local/opt/readline/lib/libreadline.7.dylib
If you’re using
rvm
you can run this to reinstall the current version which worked for me 😃Also some great options to try out here: https://stackoverflow.com/questions/16756287/cannot-execute-rails-console-due-to-an-error-with-readline/16775469
gem ‘rb-readline’ as enderahmetyurt said works fine for rails console.
Same issue,
ln -s /usr/local/opt/readline/lib/libreadline.8.0.dylib /usr/local/opt/readline/lib/libreadline.7.dylib
works perfectly
@saxxi Thank you. That worked for me as well!
Thanks @enderahmetyurt. It definitely was the easiest solution! Mac OSX 10.12.3, Ruby-2.3.0 and Rails-5.0.1
I had to use @enderahmetyurt’s solution first and then create the symlink using @LegaKh’s suggestion.
The same problem here. What helped in the end was:
@cmolenda reinstalling Ruby is what did it for me. Homebrew must have decided to upgrade readline without me knowing, which broke Ruby. Yay development tooling!
@enderahmetyurt give this man a beer
Thanks @enderahmetyurt. It works!
@jeffrey008 I imploded the RVM and reinstalled it.
ln -s /usr/local/opt/readline/lib/libreadline.8.0.dylib /usr/local/opt/readline/lib/libreadline.7.dylib
Run above code and then run
rails c
Then it should work.
This solution worked for me working with a Docker image of
ruby:2.6
. I wonder why I had to do that on my host machine so that my entrypoint configured asirb
could work. Thanks @cmolenda.