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

前端 未结 27 1318
孤城傲影
孤城傲影 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:56

    in my case, I reinstall all packages installed with Homebrew

    $ brew list | xargs brew reinstall
    

    After that, I start to install my version that I need

    0 讨论(0)
  • 2020-11-27 09:57

    I had problems because my version of PHP (7.3) was expecting icu4c 63 and brew would only install 64.

    https://stackoverflow.com/a/55828190/2000947 helped me install 63.

    0 讨论(0)
  • 2020-11-27 10:01

    I had the same problem after I upgraded my macOS to version 10.13.6. I can't run composer and php commands. After researching for a while and trying various solutions posted online, reinstalling php using homebrew worked.

    brew reinstall php@7.1

    Added on March 14th based on Ryan's comment

    get the version you are currently using by running php -v and get the right formulae (which you can find here: https://formulae.brew.sh/formula/php) to replace @7.1 in the above command.

    0 讨论(0)
  • 2020-11-27 10:01

    On OSX 10.15.4 running xcode-select --install fixed the issue for me.

    0 讨论(0)
  • [2020] edition

    For me, it was installing icu4c with the needed version.

    If you need to install the old version like version 62, (same steps for else versions), you need to:

    1. Create your own repo (or find someones repo) with this version of brew tap (links are different for every version):

    version 62

    https://raw.githubusercontent.com/Homebrew/homebrew-core/575eb4bbef683551e19f329f60456b13a558132f/Formula/icu4c.rb
    

    version 64

    https://raw.githubusercontent.com/Homebrew/homebrew-core/a806a621ed3722fb580a58000fb274a2f2d86a6d/Formula/icu4c.rb 
    

    version 66

    https://raw.githubusercontent.com/Homebrew/homebrew-core/22fb699a417093cd1440857134c530f1e3794f7d/Formula/icu4c.rb
    

    version 67

    https://raw.githubusercontent.com/Homebrew/homebrew-core/88b9cc789820f2f544d8d4a1053eebb044c2926c/Formula/icu4c.rb
    
    1. [yourUsername]/homebrew-versions/Formula/
    2. Place downloaded file to 'Formula' folder
    3. brew tap [yourUsername]/homebrew-versions
    4. brew install [yourUsername]/homebrew-versions/icu4c
    5. You got it!

    Where [yourUsername] is the name of your GitHub account or person who already have the needed version tap.

    Unfortunately, latest homebrew gives no longer a warning and now displays the error: Error: Calling Installation of XXX from a GitHub commit URL is disabled! Use 'brew extract XXX' to stable tap on GitHub instead. So the way to go now is to create a new repo on github called homebrew-versions to host the Formula in a Tap Then initialise it with: brew tap-new MYORG/homebrew-versions after git cloning the homebrew repo as suggested by Shine Hugh, copy paste the raw ruby file to your new Formula. Beware the funny naming convention! Example: File name is: gettext@0.20.2.rb Class name is: GettextAT0202 Example: https://github.com/nedap/homebrew-versions

    source:https://itnext.io/how-to-install-an-older-brew-package-add141e58d32

    0 讨论(0)
  • 2020-11-27 10:03

    This is what finally worked for me.

    brew reinstall postgres

    After running the above command you might need to run

    brew postgresql-upgrade-database

    to access your previous data.

    0 讨论(0)
提交回复
热议问题