dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.62.dylib error running php after installing node with brew on Mac
✔ Recommended Answer
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 icu4cbrew upgrade // or upgrade all packages
and finally
brew cleanup
Source: stackoverflow.com
Answered By: Full Stack Alien
This error can occur on a Mac when you install Node.js using Homebrew and it upgrades the ICU library used by PHP. The upgraded ICU library may not be compatible with your version of PHP, causing the dyld: Library not loaded
error when running PHP.
To resolve this issue, you can try one of the following solutions:
Reinstall PHP: You can try reinstalling PHP using Homebrew to ensure that it is compatible with the upgraded ICU library. You can do this by running the following command:
brew reinstall php
This will reinstall the latest version of PHP available from Homebrew.
Link the old ICU library: If you don't want to reinstall PHP, you can try linking the old ICU library used by PHP before the upgrade. To do this, you can run the following commands:
bashbrew unlink icu4c brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/c80b5d5a91a7a902f9cc634b34e064433605a2e7/Formula/icu4c.rb
This will unlink the upgraded ICU library and install the old ICU library that was used by PHP before the upgrade. Note that this approach may cause compatibility issues with other applications that require the upgraded ICU library.
Downgrade Node.js: If you don't need the latest version of Node.js, you can try downgrading it to a version that is compatible with your version of PHP. You can do this by running the following command:
cssbrew install node@10
This will install Node.js version 10, which is known to be compatible with some older versions of PHP.
Once you have tried one of these solutions, you can try running PHP again to see if the issue has been resolved.
Comments
Post a Comment