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

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

    In my case, brew update icu4c to version 67.1 so my php7.1 doesn't work. Just reinstall icu4c, then it fine.

    Ref this: https://devhoi.com/threads/error-dyld-library-not-loaded-usr-local-opt-icu4c-lib-libicui18n-64-dylib-with-php7-1.26/

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

    This fixed it for me:

    brew upgrade node
    
    0 讨论(0)
  • 2020-11-27 09:52

    Just brew remove php and brew install php did not work, nor did brew reinstall php. My solution was to do:

    brew remove php
    cd /usr/local/Cellar
    rm -rf php/
    brew install php
    brew doctor
    brew cleanup
    

    Now php -v gives me:

    PHP 7.3.2 (cli) (built: Feb 14 2019 10:08:45) ( NTS )
    
    0 讨论(0)
  • 2020-11-27 09:52

    Got this error, too, after installing php 7.3. I had it resolved upgrading just my old php's versions (5.6 and 7.0, not from the official repos).

    The maintainers had compiled new php versions against the current icu4c.

    In my case, PHP 7 got from 0.31 to 0.33, and the problem was solved.

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

    In my case I had to switch between two versions of icu4c since I still maintain PHP 5.6 projects (which use the old icu4c 64.2). brew install and reinstall from raw .rb links always replaces the previously installed versions for some reason.

    #fetching 64.2
    brew fetch https://raw.githubusercontent.com/Homebrew/homebrew-core/a806a621ed3722fb580a58000fb274a2f2d86a6d/Formula/icu4c.rb 
    
    #fetching stable version
    brew fetch https://raw.githubusercontent.com/Homebrew/homebrew-core/master/Formula/icu4c.rb 
    
    cd $(brew --cache)/downloads
    tar xvfz e2a83648f37dc5193016ce14fa6faeb97460258b214e805b1d7ce8956e83c1a7--icu4c-64.2.catalina.bottle.tar.gz
    tar xvfz e045a709e2e21df31e66144a637f0c77dfc154f60183c89e6b04afa2fbda28ba--icu4c-67.1.catalina.bottle.tar.gz
    mv -n icu4c/67.1 $(brew --cellar)/icu4c/
    mv -n icu4c/64.2 $(brew --cellar)/icu4c/
    

    then switch between versions

    $ brew switch icu4c 64.2
    Cleaning /usr/local/Cellar/icu4c/64.2
    Cleaning /usr/local/Cellar/icu4c/67.1
    Opt link created for /usr/local/Cellar/icu4c/64.2
    
    $ brew switch icu4c 67.1
    Cleaning /usr/local/Cellar/icu4c/64.2
    Cleaning /usr/local/Cellar/icu4c/67.1
    Opt link created for /usr/local/Cellar/icu4c/67.1
    
    0 讨论(0)
  • 2020-11-27 09:54

    I am actually quite surprised that this solution has not been presented yet, and I feel like it is the easiest solution.

    Go to GitHub, find the version of the brewfile that matches the version of icu4c that you need and get the raw version of the file (follow the links above and click View File then Raw).

    Then just have brew reinstall from that url.

    For example, version 62.1:

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

    For example, version 64.2:

    brew reinstall https://raw.githubusercontent.com/Homebrew/homebrew-core/a806a621ed3722fb580a58000fb274a2f2d86a6d/Formula/icu4c.rb
    
    0 讨论(0)
提交回复
热议问题