ある日、突然MacでPHP7.4.9が使えなくなりました😭😭😭
結構ハマりましたが、お戻りになってきてくれました🙌
結論
icu4cが69.1にあがってしまっていた。
→ brewで67.1を入れ直して、シンボリックリンクを貼ればok
エラー内容
$ php --version dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicudata.67.dylib Referenced from: /Users/user_xxx/.phpenv/versions/7.4.9/bin/php Reason: image not found Abort trap: 6
とりあえず/usr/local/opt/icu4c/lib/libicudata.67.dylib
が本当にないのか、
/usr/local/opt/icu4c/lib/
以下を確認。
→現在のシンボリックが69.1しかないので、67のシンボリックリンクを作りたい。。。🤤
$ ll /usr/local/opt/icu4c/lib/ total 137024 drwxr-xr-x 28 user_xxx staff 896 4 8 09:10 . drwxr-xr-x 12 user_xxx staff 384 5 27 17:27 .. drwxr-xr-x 6 user_xxx staff 192 4 8 09:10 icu -r--r--r-- 1 user_xxx staff 28672096 5 27 16:15 libicudata.69.1.dylib lrwxr-xr-x 1 user_xxx staff 21 4 8 09:10 libicudata.69.dylib -> libicudata.69.1.dylib -r--r--r-- 1 user_xxx staff 28665232 4 8 09:10 libicudata.a lrwxr-xr-x 1 user_xxx staff 21 4 8 09:10 libicudata.dylib -> libicudata.69.1.dylib -rw-r--r-- 1 user_xxx staff 2726984 5 27 16:15 libicui18n.69.1.dylib lrwxr-xr-x 1 user_xxx staff 21 4 8 09:10 libicui18n.69.dylib -> libicui18n.69.1.dylib ...
1.brewでicu4cの67をいれる。
brew tap-new
とかbrew extract
を使うやり方をしらなくてハマりました。
$ brew tap-new kin29/taps #「kin29」の部分はなんでもokです Initialized empty Git repository in /usr/local/Homebrew/Library/Taps/kin29/homebrew-taps/.git/ [main (root-commit) 58a4f09] Create kin29/taps tap 3 files changed, 88 insertions(+) create mode 100644 .github/workflows/publish.yml create mode 100644 .github/workflows/tests.yml create mode 100644 README.md ==> Created kin29/taps /usr/local/Homebrew/Library/Taps/kin29/homebrew-taps When a pull request making changes to a formula (or formulae) becomes green (all checks passed), then you can publish the built bottles. To do so, label your PR as `pr-pull` and the workflow will be triggered.
$ brew extract icu4c kin29/taps --version 67 ==> Searching repository history ==> Writing formula for icu4c from revision e2c833d to: /usr/local/Homebrew/Library/Taps/kin29/homebrew-taps/Formula/icu4c@67.rb
$ brew install kin29/taps/icu4c@67 ==> Installing icu4c@67 from kin29/taps ==> Downloading https://github.com/unicode-org/icu/commit/715d254a02b0b22681cb6f861b0921ae668fa7d6.patch?full_index=1 Already downloaded: /Users/user_xxx/Library/Caches/Homebrew/downloads/0dd175e315a7eee5f9fb42af4e03d2130e3a3aa130db4d2b32a58b1c88d87251--715d254a02b0b22681cb6f861b0921ae668fa7d6.patch ==> Downloading https://github.com/unicode-org/icu/releases/download/release-67-1/icu4c-67_1-src.tgz Already downloaded: /Users/user_xxx/Library/Caches/Homebrew/downloads/5652b331b5400231692d0879d41522870a20598d8771342b622d543c2ed99ca0--icu4c-67_1-src.tgz ==> Patching ==> Applying 715d254a02b0b22681cb6f861b0921ae668fa7d6.patch patching file source/common/uassert.h ==> ./configure --prefix=/usr/local/Cellar/icu4c@67/67.1 --disable-samples --disable-tests --enable-static --with-library-bits=64 ==> make ==> make install ==> Caveats icu4c@67 is keg-only, which means it was not symlinked into /usr/local, because macOS provides libicucore.dylib (but nothing else). If you need to have icu4c@67 first in your PATH, run: echo 'export PATH="/usr/local/opt/icu4c@67/bin:$PATH"' >> /Users/user_xxx/.bash_profile echo 'export PATH="/usr/local/opt/icu4c@67/sbin:$PATH"' >> /Users/user_xxx/.bash_profile For compilers to find icu4c@67 you may need to set: export LDFLAGS="-L/usr/local/opt/icu4c@67/lib" export CPPFLAGS="-I/usr/local/opt/icu4c@67/include" For pkg-config to find icu4c@67 you may need to set: export PKG_CONFIG_PATH="/usr/local/opt/icu4c@67/lib/pkgconfig" ==> Summary 🍺 /usr/local/Cellar/icu4c@67/67.1: 258 files, 71.8MB, built in 4 minutes 47 seconds
icu4c@67がインストールされたことを確認!
$ ll /usr/local/Cellar/ | grep icu drwxr-xr-x 4 user_xxx staff 128 5 27 16:15 icu4c drwxr-xr-x 3 user_xxx admin 96 5 29 18:04 icu4c@67
$ ll /usr/local/opt/ | grep icu4c lrwxr-xr-x 1 user_xxx admin 20 5 27 16:15 icu4c -> ../Cellar/icu4c/69.1 lrwxr-xr-x 1 user_xxx admin 23 5 29 18:09 icu4c@67 -> ../Cellar/icu4c@67/67.1 #今回追加分
2.シンボリックリンクを貼る⚠️
ln -s [パス] [リンク名]
です。私はパスとリンク名の指定が逆と勘違いしていて、ハマりました💦
(間違えたらunlink [リンク名]
で削除できます。)
$ cd /usr/local/opt/icu4c/lib/ $ ln -s ../../../icu4c@67.1/67.1/lib/libicuio.67.1.dylib libicuio.67.dylib $ ln -s ../../../icu4c@67.1/67.1/lib/libicui18n.67.1.dylib libicui18n.67.dylib $ ln -s ../../../icu4c@67.1/67.1/lib/libicuuc.67.1.dylib libicuuc.67.dylib $ ln -s ../../../icu4c@67.1/67.1/lib/libicudata.67.1.dylib libicudata.67.dylib $ ln -s ../../../icu4c@67.1/67.1/lib/libicutest.67.1.dylib libicutest.67.dylib $ ln -s ../../../icu4c@67/67.1/lib/libicutu.67.1.dylib libicutu.67.dylib
シンボリックリンクが貼れていることを確認します。
$ ll /usr/local/opt/icu4c/lib/ | grep 67.dy lrwxr-xr-x 1 user_xxx staff 50 5 29 22:11 libicudata.67.dylib -> ../../../icu4c@67.1/67.1/lib/libicudata.67.1.dylib lrwxr-xr-x 1 user_xxx staff 50 5 29 22:09 libicui18n.67.dylib -> ../../../icu4c@67.1/67.1/lib/libicui18n.67.1.dylib lrwxr-xr-x 1 user_xxx staff 48 5 29 22:08 libicuio.67.dylib -> ../../../icu4c@67.1/67.1/lib/libicuio.67.1.dylib lrwxr-xr-x 1 user_xxx staff 50 5 29 22:09 libicutest.67.dylib -> ../../../icu4c@67.1/67.1/lib/libicutest.67.1.dylib lrwxr-xr-x 1 user_xxx staff 46 5 29 22:09 libicutu.67.dylib -> ../../../icu4c@67/67.1/lib/libicutu.67.1.dylib lrwxr-xr-x 1 user_xxx staff 48 5 29 22:09 libicuuc.67.dylib -> ../../../icu4c@67.1/67.1/lib/libicuuc.67.1.dylib
PHP7.4お戻りになってくれたー😭😭😭ありがとう🎊
php --version PHP 7.4.9 (cli) (built: Dec 26 2020 23:21:06) ( NTS ) Copyright (c) The PHP Group Zend Engine v3.4.0, Copyright (c) Zend Technologies with Zend OPcache v7.4.9, Copyright (c), by Zend Technologies with Xdebug v3.0.1, Copyright (c) 2002-2020, by Derick Rethans
助けてくれてありがとうございました🙇♂️
ref: https://www.tohuandkonsome.site/entry/2021/05/21/173612