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

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

提交回复
热议问题