dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.62.dylib error running php after installing node with brew on Mac

前端 未结 27 1343
孤城傲影
孤城傲影 2020-11-27 09:02

I installed node using homebrew (Mojave), afterwards php stoped working and if I try to run php -v I get this error:

php -v
dyld: Library not lo         


        
27条回答
  •  难免孤独
    2020-11-27 09:47

    Turns out I, like @Grey Black, had to actually install v62.1 of icu4c. Nothing else worked.

    However, brew switch icu4c 62.1 only works if you have installed 62.1 in the past. If you haven't there's more legwork involved. Homebrew does not make it easy to install previous versions of formulae.

    Here's how I did it:

    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

提交回复
热议问题