美文网首页
执行php -v 提示 dyld:Library not loa

执行php -v 提示 dyld:Library not loa

作者: _oenday | 来源:发表于2023-03-14 23:58 被阅读0次

系统环境:macOS Big Sur 11.7
PHP 版本:7.4.33

起因是升级 Mac 系统,导致以前安装配置好的 PHP 版本也升级了,自己想重新安装低版本的 PHP 后执行 php -v 提示 dyld:Library not load:/usr/local/opt/ icu4c/lib/libicuio.71.dylib

Md Lieeey rot Loodedfusenecaloettcutcntbntbtcuto.71.dy1t6.png

其实就是 php 版本与 icu4c 这个扩展库版本不兼容了,以下内容引用自 stackoverflow 一位博主解答,亲测有效。其大致思路就是去 icu4c 这个扩展的 git 提交历史 log 中重新检出低版本的,然后锁定当前版本,确保不会被 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

相关文章

网友评论

      本文标题:执行php -v 提示 dyld:Library not loa

      本文链接:https://www.haomeiwen.com/subject/uezkrdtx.html