macOS Catalina 10.15.4 rbenv ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin19]
After brew install rbenv, an error occurred when checking the version or rbenv init.
$ rbenv -v
dyld: Library not loaded: /usr/local/opt/readline/lib/libreadline.6.dylib
  Referenced from: /usr/local/bin/bash
  Reason: image not found
Abort trap: 6
I have confirmed that readline is installed by homebrew with dependency resolution.
$ ls /usr/local/opt/readline/lib/
libhistory.8.0.dylib   libhistory.a           libreadline.8.0.dylib  libreadline.a          pkgconfig/
libhistory.8.dylib@    libhistory.dylib@      libreadline.8.dylib@   libreadline.dylib@
It seems that it can be solved by making a symbolic link from libreadline.6.dylib to libhistory.dylib.
$ ln -s /usr/local/opt/readline/lib/libreadline.dylib /usr/local/opt/readline/lib/libreadline.6.dylib
$ ls /usr/local/opt/readline/lib/
libhistory.8.0.dylib   libhistory.a           libreadline.6.dylib@   libreadline.8.dylib@   libreadline.dylib@
libhistory.8.dylib@    libhistory.dylib@      libreadline.8.0.dylib  libreadline.a          pkgconfig/
$ rbenv -v
dyld: Library not loaded: /usr/local/opt/readline/lib/libhistory.6.dylib
  Referenced from: /usr/local/bin/bash
  Reason: image not found
Abort trap: 6
The readline error is gone, but libhistory seems to need the same thing.
$ ln -s /usr/local/opt/readline/lib/libhistory.dylib /usr/local/opt/readline/lib/libhistory.6.dylib
$ rbenv -v
rbenv 1.1.2
solved.
Recommended Posts