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

Jonathan Tuzman picture Jonathan Tuzman · Jan 18, 2019 · Viewed 39.5k times · Source

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.

Answer

Hawz picture Hawz · Jan 21, 2019

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.