Mac で Library not loaded: /usr/local/opt/icu4c/lib/libicuio.67.dylib というエラー
2021-08-25
3分で読了
更新: 2025-12-14
目次
iMac のターミナルで php -v を実行しようとしたところ下記のエラーが出ました。
dyld: Library not loaded: /usr/local/opt/tidy-html5/lib/libtidy.5.dylib Referenced from: /usr/local/Cellar/php/7.4.7/bin/php Reason: image not found zsh: abort php -v
brew upgrade と brew cleanup を実行してみましたが変化なし。
ということで PHP を再インストールしようと brew install php@7.4 を実行してみたら、ちゃんとインストールできず。
Error: python@3.9: the bottle needs the Apple Command Line Tools to be installed.
You can install them, if desired, with:
xcode-select --install
You can try to install from source with:
brew install --build-from-source python@3.9
Please note building from source is unsupported. You will encounter build
failures with some formulae. If you experience any issues please create pull
requests instead of asking for help on Homebrew's GitHub, Twitter or any other
official channels.そこで、まずは xcode-select --install を実行して、その後 brew install php@7.4 を実行してインストールできました。
その後 php -v をしてみると、
% php -v
PHP 8.0.9 (cli) (built: Jul 29 2021 17:21:21) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.9, Copyright (c) Zend Technologies
with Zend OPcache v8.0.9, Copyright (c), by Zend Technologiesあれ、PHP 8 になってる?
終わり良ければすべてよしということで?
まあ、実際のところは、インストールのログを見てみたら PHP 8 も一緒にインストールされていて、今まで /usr/local/Cellar/php/7.4.7/bin を優先的に使うようにパスを通していたのですが、PHP 7.4 のパスが /usr/local/Cellar/php@7.4/7.4.22/bin/php になったから、デフォルトの PHP のバージョンが使われるようになったということです。