Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Library not loaded: /usr/local/opt/readline/lib/libreadline.7.dylib

When I try running rails console I get this error:

/Users/TuzsNewMacBook/.rvm/gems/ruby-2.3.7/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require':
 dlopen(/Users/TuzsNewMacBook/.rvm/rubies/ruby-2.3.7/lib/ruby/2.3.0/x86_64-darwin18/readline.bundle, 9): 
Library not loaded: /usr/local/opt/readline/lib/libreadline.7.dylib (LoadError)

A quick search got me to this post and I've tried a few things:

brew reinstall postgresql (this is indeed the DB for this project)

and

cd /usr/local/opt/readline/lib    
ln libreadline.8.0.dylib libreadline.6.2.dylib

(my version of readline is 8)

and brew link readline --force

But none of these have fixed it.

I recently added pry-coolline, guard and guard-livereload gems to my project if that makes any difference (rails console loaded fine before those). I'm running on the latest macos.

(Update) I’m using pry rails as my rails console, if that makes any difference.

Any help? Thanks.

like image 596
Jonathan Tuzman Avatar asked Oct 20 '22 01:10

Jonathan Tuzman


2 Answers

the error seems to be thrown when searching for /usr/local/opt/readline/lib/libreadline.7.dylib.

Have you tried to symlink that?

So something like:

cd /usr/local/opt/readline/lib 
ln -s libreadline.8.0.dylib libreadline.7.dylib

Just tried that on macOS Mojave, ruby 2.5.3p105 and Rails 5.2.2 and worked.

like image 397
Hawz Avatar answered Oct 21 '22 14:10

Hawz


Reinstalling my Ruby version seems to have fixed it:

rvm reinstall 2.3.7
like image 43
Jonathan Tuzman Avatar answered Oct 21 '22 15:10

Jonathan Tuzman