byebug: "Sorry, you can't use byebug without Readline"
I started encountering this issue inside a Rails app with byebug 9.0.5 and Ruby 2.2.5. Didn’t change either Rails or Ruby after installing byebug. One day it worked fine, the next I couldn’t boot the Rails app due to this issue. I’m really curious if there’s any other solution than reinstalling that Ruby version.
Sorry, you can't use byebug without Readline. To solve this, you need to
rebuild Ruby with Readline support. If using Ubuntu, try `sudo apt-get
install libreadline-dev` and then reinstall your Ruby.
/Users/olivierlacan/.rbenv/versions/2.2.5/lib/ruby/gems/2.2.0/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:274:in `require': dlopen(/Users/olivierlacan/.rbenv/versions/2.2.5/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/olivierlacan/.rbenv/versions/2.2.5/lib/ruby/2.2.0/x86_64-darwin15/readline.bundle
Reason: image not found - /Users/olivierlacan/.rbenv/versions/2.2.5/lib/ruby/2.2.0/x86_64-darwin15/readline.bundle
It’s honestly a little odd, I don’t remember needing to do anything special with Rubies on prior versions of byebug so I’m thinking this might be less straightforward than it appears perhaps. In any case this issue should help others since I couldn’t find any exact matches on Google for this exact error message.
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 36
- Comments: 53 (3 by maintainers)
Commits related to this issue
- Update Ruby Version to 2.3.1 Minor ===== * Had to add `rb-readline` gem for this Ruby to work correctly. https://github.com/deivid-rodriguez/byebug/issues/289#issuecomment-251383465 — committed to adarsh/youshouldtotally by adarsh 8 years ago
- Fix byebug error Not certain why but in certain circumstances ruby seems to lose it's link to the readline dylib causing byebug to raise errors when being required, possibly as a result of a 'brew up... — committed to ministryofjustice/correspondence_tool_public by misaka 8 years ago
- fix(rb-readline): add 'rb-readline' as dev dependency to fix 'byebug' installation - when installing (on Mac OS Sierra for instance), `byebug` generated an error since it required `readline` which wa... — committed to nicolasrouanne/rails-templates by nicolasrouanne 7 years ago
To fix this (for OSX, tested on Sierra), run following command in your shell -
ln -s /usr/local/opt/readline/lib/libreadline.dylib /usr/local/opt/readline/lib/libreadline.6.dylib@mehta 's command is indeed what fixed the issue for me. Just make sure you’re using it with the right
libreadlineversion in the second part.Someone also suggested adding
rb-readlineas a development group dependency in the Gemfile: https://twitter.com/ndrx42/status/783288843906801664same as @coisnepe - had to use 7:
@bf4 's solution works for me, thanks @bf4 .
I met this problem after homebrew upgrading the readline from 7.0.5 to 8.0.
I use
brew switch readline 7.0.5to revert it back and it works back.Same problem as @baurine in that some library is looking for libreadline.7.dylib even after I upgraded to readline 8. So I used
cd /usr/local/opt/readline/libln -s libreadline.dylib libreadline.7.dylibI’m not proud but it works.
I had reinstalled ruby. It have been works well.
Apologies for commenting on an old thread, but if you’re on homebrew, the simplest command is something like
brew switch readline 6.3.8(it’s likely installed in/usr/local/Cellar/readline/)If you use rvm you can equally run
rvm reinstall <ruby-version>to resolve the readline mismatch.I was using the
gem 'rb-readline'workaround but it stopped working for me yesterday. After some googling I found that a solution is to rebuild ruby on os/x, this way it’s built on the latest libs / header files. This worked for me and seems more like a solution than a work-around.I wrote up a gist here to give solutions for
rvmandrbenvusers: https://gist.github.com/soultech67/33ba09706e091c06ce66684cd28015ac@mehta solution worked for me too.
how @donald-s said you can just reinstall Ruby 👌
Apparently this could be due to Homebrew:
For me this was the output:
@mehta answer worked for me too, but had to do a bit change on Linux like below.
sudo ln -s /usr/lib/libreadline.so /usr/lib/libreadline.so.6@olivierlacan 's post worked for me, thanks so much!
Also on a side note, loving Ruby Facets man!
Looks like this is related to #118 and could actually be a dupe, please close if that’s the case. It seems like recommending
rb-readlineas a development dependency tends to lead to issues.On OSX:
Then look for the installed version of readline’s libreadline.X.X.dylib library. For illustration through example, this is what I saw:
Then just
cdinto the appropriate directory, here it would be:And then you can create the symlink you need for your missing library. For me, that the original error was
Library not loaded: /usr/local/opt/readline/lib/libreadline.7.dylib, so I ran this command:And like magic - it’s fixed!! Thank you @mehta !!!
@mehta - This solution is absolutely right. All you need is locate libreadline.dylib in your macOS system (I am using macports). Probably libreadline.dylib is symlink to another libreadline library. In my case it is libreadline.8.0.dylib. So in same dir where is this file create symlink:
ln -s libreadline.8.0.dylib libreadline.6.dylibNow byebug starts to work
We tried that for a while but that caused problems for non windows users. I’ll try to migrate to use the brand new pury ruby readline implementation that ruby 2.7 will use by default: reline.
I ran into this issue today and it appears that the problem for me was that a recent update for XCode failed. Reinstalling a fresh version of XCode and then reinstalling the Ruby version worked for me.
Thank you! I just needed to change the symlink to point to
7instead but it worked after.ln -s libreadline.8.0.dylib libreadline.7.dylib