Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Sorry, you can't use byebug without Readline" #289

Closed
olivierlacan opened this Issue Oct 4, 2016 · 42 comments

Comments

Projects
None yet
@olivierlacan
Copy link

olivierlacan commented Oct 4, 2016

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.

@olivierlacan

This comment has been minimized.

Copy link
Author

olivierlacan commented Oct 4, 2016

Apparently this could be due to Homebrew:

@olivierlacan I had this issue on Friday after bumping a bunch of Homebrew libs. Had to recompile Ruby to fix!

@olivierlacan one of these will be the offender - brew uses --installed readline

For me this was the output:

$ brew uses --installed readline
augeas   bash   postgresql   python   sqlite
@chattsm

This comment has been minimized.

Copy link

chattsm commented Oct 4, 2016

Hi @olivierlacan, what is your output from brew info readline?

Mine is...

$ brew info readline
readline: stable 7.0 (bottled) [keg-only]
Library for command-line editing
https://tiswww.case.edu/php/chet/readline/rltop.html
/usr/local/Cellar/readline/7.0 (45 files, 2M)
  Poured from bottle on 2016-09-30 at 11:07:04
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/readline.rb

My Ruby (managed by ruby-install / chruby) broke after 2016-09-30 at 11:07:04, which is when I updated a bunch of my Homebrew installs and ran a brew cleanup (thus removing readline v6.0).

$ ls -l /usr/local/opt/readline/lib
total 2744
-r--r--r--  1 chattsm  admin   84728 30 Sep 11:07 libhistory.7.0.dylib
lrwxr-xr-x  1 chattsm  admin      20  7 Sep 22:16 libhistory.7.dylib -> libhistory.7.0.dylib
-r--r--r--  1 chattsm  admin   84480  7 Sep 22:16 libhistory.a
lrwxr-xr-x  1 chattsm  admin      20  7 Sep 22:16 libhistory.dylib -> libhistory.7.0.dylib
-r--r--r--  1 chattsm  admin  459608 30 Sep 11:07 libreadline.7.0.dylib
lrwxr-xr-x  1 chattsm  admin      21  7 Sep 22:16 libreadline.7.dylib -> libreadline.7.0.dylib
-r--r--r--  1 chattsm  admin  751528  7 Sep 22:16 libreadline.a
lrwxr-xr-x  1 chattsm  admin      21  7 Sep 22:16 libreadline.dylib -> libreadline.7.0.dylib

I had to re-compile Ruby to fix this issue. Interesting to know if there is a better/simpler fix for it!

@olivierlacan

This comment has been minimized.

Copy link
Author

olivierlacan commented Oct 4, 2016

Someone also suggested adding rb-readline as a development group dependency in the Gemfile: https://twitter.com/ndrx42/status/783288843906801664

@olivierlacan

This comment has been minimized.

Copy link
Author

olivierlacan commented Oct 4, 2016

@chattsm

$ brew info readline
readline: stable 7.0 (bottled) [keg-only]
Library for command-line editing
https://tiswww.case.edu/php/chet/readline/rltop.html
/usr/local/Cellar/readline/6.3.8 (46 files, 2.0M)
  Poured from bottle on 2015-09-11 at 16:22:41
/usr/local/Cellar/readline/7.0 (45 files, 2M)
  Poured from bottle on 2016-10-03 at 18:43:51
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/readline.rb
==> Caveats
This formula is keg-only, which means it was not symlinked into /usr/local.

OS X provides the BSD libedit library, which shadows libreadline.
In order to prevent conflicts when programs look for libreadline we are
defaulting this GNU Readline installation to keg-only.


Generally there are no consequences of this for you. If you build your
own software and it requires this formula, you'll need to add to your
build variables:

    LDFLAGS:  -L/usr/local/opt/readline/lib
    CPPFLAGS: -I/usr/local/opt/readline/include
@olivierlacan

This comment has been minimized.

Copy link
Author

olivierlacan commented Oct 4, 2016

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-readline as a development dependency tends to lead to issues.

@deivid-rodriguez

This comment has been minimized.

Copy link
Owner

deivid-rodriguez commented Oct 4, 2016

@olivierlacan Did you try reinstalling your Ruby after sorting out your readline libraries? I'm not aware of a better solution...

By the way, anyone contributing to the discussion here, feel free to improve the troubleshooting instructions for OSX. I don't use that, so I have no idea. Or maybe a wiki page should be created and linked from the error message, I don't know.

@kntmrkm

This comment has been minimized.

Copy link

kntmrkm commented Oct 5, 2016

I had reinstalled ruby. It have been works well.

adarsh added a commit to adarsh/youshouldtotally that referenced this issue Oct 7, 2016

Update Ruby Version to 2.3.1
Minor
=====
* Had to add `rb-readline` gem for this Ruby to work correctly.

deivid-rodriguez/byebug#289 (comment)
@deivid-rodriguez

This comment has been minimized.

Copy link
Owner

deivid-rodriguez commented Oct 9, 2016

I'm going to close this since it does not seem like a problem in byebug.

misaka added a commit to ministryofjustice/correspondence_tool_public that referenced this issue Dec 1, 2016

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 update'. The fix in this
commit is mentioned here:

deivid-rodriguez/byebug#289

The alternative seems to be to recompile ruby.

@misaka misaka referenced this issue Dec 1, 2016

Merged

Fix byebug error #97

@mehta

This comment has been minimized.

Copy link

mehta commented Dec 6, 2016

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

@kirillshevch

This comment has been minimized.

Copy link

kirillshevch commented Dec 8, 2016

@mehta thanks!

@parquar

This comment has been minimized.

Copy link

parquar commented Dec 8, 2016

@mehta bloody perfect!

@hraynaud

This comment has been minimized.

Copy link

hraynaud commented Dec 14, 2016

@mehta solution worked for me too.

@jasonfagan

This comment has been minimized.

Copy link

jasonfagan commented Jan 5, 2017

@mehta definite fix for Sierra, no reinstall or recompile of Ruby needed. Thanks a lot for this tip!!

@iqbalhasnan

This comment has been minimized.

Copy link

iqbalhasnan commented Jan 6, 2017

Thanks @mehta

@dimosz

This comment has been minimized.

Copy link

dimosz commented Jan 8, 2017

@mehta worked for me, thanks.

@Schwad

This comment has been minimized.

Copy link

Schwad commented Jan 8, 2017

@olivierlacan 's post worked for me, thanks so much!

Someone also suggested adding rb-readline as a development group dependency in the Gemfile: https://twitter.com/ndrx42/status/783288843906801664

Also on a side note, loving Ruby Facets man!

@wflanagan

This comment has been minimized.

Copy link

wflanagan commented Jan 14, 2017

Worked for me in El Capitan as well.

@bhoormeena

This comment has been minimized.

Copy link

bhoormeena commented Jan 16, 2017

@mehta thanks buddy!

@milan-mitra

This comment has been minimized.

Copy link

milan-mitra commented Mar 1, 2017

@mehta 👍

@pinkopaque22

This comment has been minimized.

Copy link

pinkopaque22 commented Mar 27, 2017

Thanks man! That did the trick. SO grateful.

@ragavendra

This comment has been minimized.

Copy link

ragavendra commented Mar 27, 2017

@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

@danmoore2205

This comment has been minimized.

Copy link

danmoore2205 commented Apr 10, 2017

thanks @mehta saved me!

@soultech67

This comment has been minimized.

Copy link

soultech67 commented Apr 13, 2017

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 rvm and rbenv users: https://gist.github.com/soultech67/33ba09706e091c06ce66684cd28015ac

@neohunter

This comment has been minimized.

Copy link

neohunter commented May 6, 2017

Worked also on el capitan.

@robinhorios

This comment has been minimized.

Copy link

robinhorios commented May 26, 2017

@duinness

This comment has been minimized.

Copy link

duinness commented Jun 8, 2017

@mehta's solution worked for me on Yosemite

@Iqlaas

This comment has been minimized.

Copy link

Iqlaas commented Jun 19, 2017

@mehta still works mate. cheers.

@txssseal

This comment has been minimized.

Copy link

txssseal commented Jun 23, 2017

@mehta gracias senor

@baird

This comment has been minimized.

Copy link

baird commented Jun 28, 2017

@mehta my dude

@tarlig

This comment has been minimized.

Copy link

tarlig commented Jun 28, 2017

@mehta Dankeschoen! Excellent!

nicolasrouanne added a commit to nicolasrouanne/rails-templates that referenced this issue Jul 17, 2017

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 wasn't installed
- see `byebug` related issue
@link deivid-rodriguez/byebug#289
@bf4

This comment has been minimized.

Copy link

bf4 commented Jan 30, 2018

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/ )

@wayne-crs

This comment has been minimized.

Copy link

wayne-crs commented Dec 10, 2018

@mehta Cheers. Worked for me on High Sierra

@yogeshmurugesan

This comment has been minimized.

Copy link

yogeshmurugesan commented Dec 24, 2018

@mehta worked for me.

@coisnepe

This comment has been minimized.

Copy link

coisnepe commented Jan 14, 2019

@mehta 's command is indeed what fixed the issue for me. Just make sure you're using it with the right libreadline version in the second part.

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

This comment has been minimized.

Copy link

baurine commented Jan 21, 2019

@bf4 's solution works for me, thanks @bf4 .

I met this problem after homebrew upgrading the readline from 7.0.5 to 8.0.

> ls -alh /usr/local/opt/readline/lib
total 1448
drwxr-xr-x  11 baurine  staff   352B Dec 20 05:07 .
drwxr-xr-x  12 baurine  staff   384B Jan 17 15:27 ..
-r--r--r--   1 baurine  staff    39K Jan 17 15:27 libhistory.8.0.dylib
lrwxr-xr-x   1 baurine  staff    20B Dec 20 05:07 libhistory.8.dylib -> libhistory.8.0.dylib
-r--r--r--   1 baurine  staff    45K Dec 20 05:07 libhistory.a
lrwxr-xr-x   1 baurine  staff    20B Dec 20 05:07 libhistory.dylib -> libhistory.8.0.dylib
-rw-r--r--   1 baurine  staff   234K Jan 17 15:27 libreadline.8.0.dylib
lrwxr-xr-x   1 baurine  staff    21B Dec 20 05:07 libreadline.8.dylib -> libreadline.8.0.dylib
-r--r--r--   1 baurine  staff   397K Dec 20 05:07 libreadline.a
lrwxr-xr-x   1 baurine  staff    21B Dec 20 05:07 libreadline.dylib -> libreadline.8.0.dylib

> ls -alh /usr/local/Cellar/readline
total 0
drwxr-xr-x   5 baurine  staff   160B Jan 17 15:27 .
drwxrwxr-x  75 baurine  admin   2.3K Jan 17 15:35 ..
drwxr-xr-x  12 baurine  admin   384B Jan 25  2018 7.0.3_1
drwxr-xr-x  12 baurine  staff   384B Sep  6 16:41 7.0.5
drwxr-xr-x  12 baurine  staff   384B Jan 17 15:27 8.0.0

I use brew switch readline 7.0.5 to revert it back and it works back.

> brew switch readline 7.0.5
Cleaning /usr/local/Cellar/readline/8.0.0
Cleaning /usr/local/Cellar/readline/7.0.5
Cleaning /usr/local/Cellar/readline/7.0.3_1
Opt link created for /usr/local/Cellar/readline/7.0.5
@LarryWachira

This comment has been minimized.

Copy link

LarryWachira commented Jan 23, 2019

If you use rvm you can equally run rvm reinstall <ruby-version> to resolve the readline mismatch.

@skbailey

This comment has been minimized.

Copy link

skbailey commented Jan 23, 2019

@mehta the real MVP, this worked for me

@itcentralstation

This comment has been minimized.

Copy link

itcentralstation commented Jan 27, 2019

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/lib
ln -s libreadline.dylib libreadline.7.dylib

I'm not proud but it works.

@pranav-bagree

This comment has been minimized.

Copy link

pranav-bagree commented Jan 28, 2019

@itcentralstation this worked for me! Thanks 👍

@davidcpell

This comment has been minimized.

Copy link

davidcpell commented Jan 31, 2019

same as @coisnepe - had to use 7:

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

This comment has been minimized.

Copy link

srikirancse commented Feb 4, 2019

@mehta Man of the hour!

@storrence88

This comment has been minimized.

Copy link

storrence88 commented Mar 14, 2019

@itcentralstation This worked for me! Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.