tigの起動時にdyld: Library not loadedというreadlineのライブラリ参照エラーが出てしまう問題

tigを使おうとしたところ下記のようなエラーが。。

$ tig
dyld: Library not loaded: /usr/local/opt/readline/lib/libreadline.7.dylib
  Referenced from: /usr/local/bin/tig
  Reason: image not found
Abort trap: 6

readlineのライブラリが参照できないということなので、すでに入っているライブラリを調べてみると

$ brew info readline
readline: stable 8.0.0 (bottled) [keg-only]
Library for command-line editing
https://tiswww.case.edu/php/chet/readline/rltop.html
/usr/local/Cellar/readline/8.0.0 (48 files, 1.5MB)
  Poured from bottle on 2019-01-29 at 09:57:33
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/readline.rb
==> Caveats
readline is keg-only, which means it was not symlinked into /usr/local,
because 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 readline you may need to set:
  export LDFLAGS="-L/usr/local/opt/readline/lib"
  export CPPFLAGS="-I/usr/local/opt/readline/include"

For pkg-config to find readline you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/readline/lib/pkgconfig"

==> Analytics
install: 552,353 (30 days), 1,051,193 (90 days), 3,479,037 (365 days)
install_on_request: 67,280 (30 days), 108,614 (90 days), 330,266 (365 days)
build_error: 0 (30 days)

と8系しか入っていなかったので、tigをアップデートしてみました

$ brew upgrade tig

アップデートして動作を確認してみると

$ tig
dyld: Library not loaded: /usr/local/opt/readline/lib/libreadline.8.dylib
  Referenced from: /usr/local/bin/tig
  Reason: image not found
Abort trap: 6

readlineの8系を参照しようとしているので

$ brew link readline --force

として参照先にリンクを貼ったところ無事起動するようになりました🎉