readlineが7にバージョンアップされてgradleとpsqlが動かなくなった
何もした覚えがないのだが、ある日急にgradleとpsqlが動かなくなった。
$ gradle tasks dyld: Library not loaded: /usr/local/opt/readline/lib/libreadline.6.dylib Referenced from: /usr/local/bin/bash Reason: image not found [1] 52259 abort gradle tasks $ psql dyld: Library not loaded: /usr/local/opt/readline/lib/libreadline.6.dylib Referenced from: /usr/local/bin/psql Reason: image not found [1] 52489 abort psql
どちらもlibreadline.6.dylib がないと言ってエラーを吐いている。
あまり記憶にないけど、Homebrewでreadlineを入れていたようで、現在は7.0.3が適用されているようだ。
$ brew info readline readline: stable 7.0.3 (bottled) [keg-only] Library for command-line editing https://tiswww.case.edu/php/chet/readline/rltop.html /usr/local/Cellar/readline/6.3.6 (46 files, 2MB) Poured from bottle on 2014-05-29 at 11:25:42 /usr/local/Cellar/readline/6.3.8 (46 files, 2MB) Poured from bottle on 2014-10-18 at 05:30:37 /usr/local/Cellar/readline/7.0.3 (46 files, 2MB) Poured from bottle on 2017-02-28 at 22:25:05 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. macOS 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. For compilers to find this software you may need to set: LDFLAGS: -L/usr/local/opt/readline/lib CPPFLAGS: -I/usr/local/opt/readline/include
6系のものに切り替えてみる
$ brew switch readline 6.3.8 Cleaning /usr/local/Cellar/readline/6.3.6 Cleaning /usr/local/Cellar/readline/6.3.8 Cleaning /usr/local/Cellar/readline/7.0.3 Opt link created for /usr/local/Cellar/readline/6.3.8
動いた!
$ psql --version psql (PostgreSQL) 9.4.0
おそらく7系をインストールした何かが動かなくなるんだろうなと思いつつ、とりあえず良しとする。