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

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

    On MacOS Mojave, only way I could fix it was with brew upgrade

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

    Update - As stated in some of the comments, running brew cleanup could possibly fix this error, if that alone doesn't fix it, you might try upgrading individual packages or all your brew packages.

    I just had this same problem. Upgrading Homebrew and then cleaning up worked for me. This error likely showed up for me because of a mismatch in package versions. None of the above solutions resolved my error, but running the following homebrew commands did.

    Caution - This will upgrade all your brew packages, including, but not limited to PHP. If you only want to upgrade specific packages make sure to be specific.

    brew upgrade // for upgrading all packages -- this is the command I used
    
    brew upgrade {package} // for upgrading a specific package
    

    and finally

    brew cleanup
    
    0 讨论(0)
  • 2020-11-27 09:43

    Seems like it is impossible to link icu4c using brew after latest OS X update. Which makes things more interesting. The only solution I found working for me:

    1. Download and compile icu4c 62.1 to /usr/local/icu4c/62.1
    mkdir ~/sources
    cd ~/sources
    wget http://download.icu-project.org/files/icu4c/62.1/icu4c-62_1-src.tgz
    tar xvzf icu4c-62_1-src.tgz
    cd icu/source/
    
    sudo mkdir /usr/local/icu4c/62.1
    ./configure --prefix=/usr/local/icu4c/62.1
    make
    sudo make install
    
    1. Link libs:
    ln -s /usr/local/icu4c/62.1/lib/*.dylib /usr/local/include/
    
    1. Set DYLD_LIBRARY_PATH in ~/.bash_profile:
    export DYLD_LIBRARY_PATH=/usr/local/include
    
    0 讨论(0)
  • 2020-11-27 09:44

    The solution in this gist did it for me

    brew uninstall --ignore-dependencies node icu4c
    brew install node
    
    0 讨论(0)
  • 2020-11-27 09:45

    In order to downgrade, i had to recompile from source (MacOS Mojave)

    $ wget https://ssl.icu-project.org/files/icu4c/62.1/icu4c-62_1-src.tgz
    $ tar xvfz icu4c-62_1-src.tgz
    $ cd icu/sources
    $ ./configure
    $ make
    $ make install
    
    0 讨论(0)
  • 2020-11-27 09:45

    I actually tried all of the solutions which made sense, mentioned in this post and yet i still got the same error when running php -v or composer. The node version was fine, npm as well there were no issues on having installed correct versions and they were all running. Running reinstall php@7.1 just threw an error. In the end i had to run:

    brew reinstall icu4c
    

    This basically worked, with me having to manually then install php dependencies such as imagick.so, imap.so As these libraries were installed for a project that i no longer maintain i can go without them. But if you do have dependancies on them, have in mind that there will be more work to do afterwards.

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