TL;DR
同じバージョンがインストールされているならそれっぽい名前のリンクを作ればよい。
現象
phpがこんなエラーを吐いて何もできなくなった。
$ php --version dyld[9229]: Library not loaded: /opt/homebrew/opt/tidy-html5/lib/libtidy.5.dylib Referenced from: /Users/kappa/.anyenv.arm64/envs/phpenv/versions/8.0.3/bin/php Reason: tried: '/opt/homebrew/opt/tidy-html5/lib/libtidy.5.dylib' (no such file), '/usr/local/lib/libtidy.5.dylib' (no such file), '/usr/lib/libtidy.5.dylib' (no such file), '/opt/homebrew/Cellar/tidy-html5/5.8.0/lib/libtidy.5.dylib' (no such file), '/usr/local/lib/libtidy.5.dylib' (no such file), '/usr/lib/libtidy.5.dylib' (no such file) Abort trap: 6
調査
phpenvでインストールしているのでtidy-html5のライブラリーがないことなないはず。 でもないこともない(ある)ので調べる。
$ brew info tidy-html5 tidy-html5: stable 5.8.0 (bottled), HEAD Granddaddy of HTML tools, with support for modern standards https://www.html-tidy.org/ /opt/homebrew/Cellar/tidy-html5/5.8.0 (14 files, 3MB) * Poured from bottle on 2021-10-07 at 00:26:41 From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/tidy-html5.rb License: Zlib ==> Dependencies Build: cmake ✔ ==> Options --HEAD Install HEAD version ==> Analytics install: 41,649 (30 days), 148,682 (90 days), 369,009 (365 days) install-on-request: 1,669 (30 days), 5,422 (90 days), 11,714 (365 days)
ある。バージョンが違うとか?
kappa%(arm64)[~]$ find /opt/homebrew/opt/tidy-html5/lib /opt/homebrew/opt/tidy-html5/lib /opt/homebrew/opt/tidy-html5/lib/libtidy.58.dylib /opt/homebrew/opt/tidy-html5/lib/libtidy.5.8.0.dylib /opt/homebrew/opt/tidy-html5/lib/pkgconfig /opt/homebrew/opt/tidy-html5/lib/pkgconfig/tidy.pc /opt/homebrew/opt/tidy-html5/lib/libtidy.dylib /opt/homebrew/opt/tidy-html5/lib/libtidy.a
バージョンのせいか homebrewをupdate/upgradeしたときに消えたのか理由はわからないけど
ともかく libtidy.5.dylib
という名前でダイナミックライブラリーファイルが必要らしい。
対応
その名前でシンボリックファイルを作成する。足りないと言われているのが5系っぽいので同じ5系なら勝手に作っても問題ないはず。
ln -s /opt/homebrew/opt/tidy-html5/lib/libtidy.58.dylib /opt/homebrew/opt/tidy-html5/lib/libtidy.5.dylib
動作を確認する。
$ php --version PHP 8.0.3 (cli) (built: Apr 6 2021 21:16:28) ( NTS ) Copyright (c) The PHP Group Zend Engine v4.0.3, Copyright (c) Zend Technologies with Zend OPcache v8.0.3, Copyright (c), by Zend Technologies with Xdebug v3.0.3, Copyright (c) 2002-2021, by Derick Rethans
無事に動作するようになった。