執(zhí)行php -v 提示 dyld:Library not load:/usr/local/opt/ icu4c/lib/libicuio.71.dylib

系統(tǒng)環(huán)境:macOS Big Sur 11.7
PHP 版本:7.4.33

起因是升級(jí) Mac 系統(tǒng),導(dǎo)致以前安裝配置好的 PHP 版本也升級(jí)了,自己想重新安裝低版本的 PHP 后執(zhí)行 php -v 提示 dyld:Library not load:/usr/local/opt/ icu4c/lib/libicuio.71.dylib

Md Lieeey rot Loodedfusenecaloettcutcntbntbtcuto.71.dy1t6.png

其實(shí)就是 php 版本與 icu4c 這個(gè)擴(kuò)展庫(kù)版本不兼容了,以下內(nèi)容引用自 stackoverflow 一位博主解答,親測(cè)有效。其大致思路就是去 icu4c 這個(gè)擴(kuò)展的 git 提交歷史 log 中重新檢出低版本的,然后鎖定當(dāng)前版本,確保不會(huì)被 brew upgrade 再次更新。

  1. We first need a deep clone of the Homebrew repo. This may take a while: git -C $(brew --repo homebrew/core) fetch --unshallow
  2. brew log icu4c to track down a commit that references 62.1; 575eb4b does the trick.
  3. cd $(brew --repo homebrew/core)
  4. git checkout 575eb4b -- Formula/icu4c.rb
  5. brew uninstall --ignore-dependencies icu4c
  6. brew install icu4c You should now have the correct version of the dependency! Now just to...
  7. git reset && git checkout . Cleanup your modified recipe.
  8. brew pin icu4c Pin the dependency to prevent it from being accidentally upgraded in the future

If you decide you do want to upgrade it at some point, make sure to run brew unpin icu4c

參考 stackoverflow @Leland
https://stackoverflow.com/questions/53828891/dyld-library-not-loaded-usr-local-opt-icu4c-lib-libicui18n-62-dylib-error-run

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

友情鏈接更多精彩內(nèi)容