环境:mac php7.3
➜ ~ php -v
dyld[40843]: Symbol not found: __ZN6icu_7310DateFormat22createDateTimeInstanceENS0_6EStyleES1_RKNS_6LocaleE
Referenced from: /usr/local/Cellar/php@7.3/7.3.33_7/bin/php
Expected in: /usr/local/Cellar/icu4c/73.2/lib/libicui18n.73.2.dylib
[1] 40843 abort php -v
终于解决了
卸载icu4c
我是先 rm -rf /usr/local/Cellar/icu4c
➜ ~ rm -rf /usr/local/Cellar/icu4c
➜ ~ php -v
dyld[15233]: Library not loaded: @loader_path/../../../../opt/icu4c/lib/libicui18n.73.dylib
Referenced from: /usr/local/Cellar/php@7.3/7.3.33_7/bin/php
Reason: tried: '/usr/local/Cellar/php@7.3/7.3.33_7/bin/../../../../opt/icu4c/lib/libicui18n.73.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS@loader_path/../../../../opt/icu4c/lib/libicui18n.73.dylib' (no such file), '/usr/local/Cellar/php@7.3/7.3.33_7/bin/../../../../opt/icu4c/lib/libicui18n.73.dylib' (no such file), '/usr/local/lib/libicui18n.73.dylib' (no such file), '/usr/lib/libicui18n.73.dylib' (no such file, not in dyld cache)
[1] 15233 abort php -v
再 brew uninstall icu4c,报错 icu4c
➜ ~ brew uninstall icu4c
==> Downloading https://formulae.brew.sh/api/formula.jws.json 100.0%
==> Downloading https://formulae.brew.sh/api/cask.jws.json
curl: (28) Operation too slow. Less than 100 bytes/sec transferred the last 5 seconds
Warning: cask.jws.json: update failed, falling back to cached version.
==> Downloading https://formulae.brew.sh/api/cask.jws.json 100.0%
Error: No such keg: /usr/local/Cellar/icu4c
再安装 icu4c,报错
~ brew install icu4c
Error: icu4c: Failed to download resource "icu4c"
Download failed: https://ghcr.io/v2/homebrew/core/icu4c/blobs/sha256:4400e31a217d6ffcd2bd06e26ecbeed768133493bfcc4cb3c9ff9702f480beb6
继续报错
curl: (28) Operation too slow. Less than 100 bytes/sec transferred the last 5 seconds
Warning: formula.jws.json: update failed, falling back to cached version.
Error: Cannot download non-corrupt https://formulae.brew.sh/api/formula.jws.json!
然后百度
Operation too slow. Less than 100 bytes/sec transferred the last 5 seconds
参考文档
设置一下
➜ ~ export HOMEBREW_NO_INSTALL_FROM_API=1
再
➜ ~ brew install icu4c
You have 26 outdated formulae installed.
==> Fetching icu4c
==> Downloading https://ghcr.io/v2/homebrew/core/icu4c/manifests/73.2
Already downloaded: /Users/laiqingtao/Library/Caches/Homebrew/downloads/2e5082de52a2c85ae665e51f8d0de0651611397cb02f4b4e2bb37898ba52a629--icu4c-73.2.bottle_manifest.json
==> Downloading https://ghcr.io/v2/homebrew/core/icu4c/blobs/sha256:4400e31a217d6ffcd2bd06e26ecbeed768133493bfcc4cb3c9ff9702f480beb6
##################################################################################################################################################################################################### 100.0%
==> Pouring icu4c--73.2.ventura.bottle.tar.gz
==> Caveats
icu4c 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 first in your PATH, run:
echo 'export PATH="/usr/local/opt/icu4c/bin:$PATH"' >> ~/.zshrc
echo 'export PATH="/usr/local/opt/icu4c/sbin:$PATH"' >> ~/.zshrc
For compilers to find icu4c you may need to set:
export LDFLAGS="-L/usr/local/opt/icu4c/lib"
export CPPFLAGS="-I/usr/local/opt/icu4c/include"
==> Summary
🍺 /usr/local/Cellar/icu4c/73.2: 268 files, 79.5MB
==> Running brew cleanup icu4c...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see man brew).
安装成功
➜ ~ PHP -v
PHP 7.3.33 (cli) (built: Aug 4 2023 15:02:14) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.33, Copyright (c) 1998-2018 Zend Technologies
with Xdebug v3.1.6, Copyright (c) 2002-2022, by Derick Rethans
with Zend OPcache v7.3.33, Copyright (c) 1999-2018, by Zend Technologies