因失误 homebrew update 升级导致 brew安装的php7.4 不能正常使用 报以下错误
dyld[40013]: Library not loaded: /opt/homebrew/opt/icu4c/lib/libicuio.69.dylib
Referenced from: /opt/homebrew/Cellar/php@7.4/7.4.27/bin/php
Reason: tried: '/opt/homebrew/opt/icu4c/lib/libicuio.69.dylib' (no such file), '/usr/local/lib/libicuio.69.dylib' (no such file), '/usr/lib/libicuio.69.dylib' (no such file), '/opt/homebrew/Cellar/icu4c/72.1/lib/libicuio.69.dylib' (no such file), '/usr/local/lib/libicuio.69.dylib' (no such file), '/usr/lib/libicuio.69.dylib' (no such file)
zsh: abort php -v
检查发现/usr/local/opt/icu4c/lib链的是72.1的,而之前安装PHP是依赖69.1的 按网上各种方法尝试 都不行 最后解决方案
看/opt/homebrew/Cellar/icu4c/是否有 php所依赖的69.1文件 有即可按如下方法
copy /opt/homebrew/Cellar/icu4c/69.1文件下所有内容 到 /usr/local/lib 目录下
建议先对 /usr/local/lib 先做好备份 在进行依赖复制