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 loaded: /usr/local/opt/icu4c/lib/libicui18n.62.dylib
Referenced from: /usr/local/bin/php
Reason: image not found
I tried to uninstall both node and icu4c but the problem persists
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 clickView File
thenRaw
).Then just have brew reinstall from that url.
For example, version
62.1
:brew update && brew upgrade
worked for meSeems like it is impossible to link
icu4c
usingbrew
after latest OS X update. Which makes things more interesting. The only solution I found working for me:icu4c
62.1 to/usr/local/icu4c/62.1
DYLD_LIBRARY_PATH
in~/.bash_profile
:Turns out I, like @Grey Black, had to actually install v62.1 of icu4c. Nothing else worked.
However,
brew switch icu4c 62.1
only works if you have installed 62.1 in the past. If you haven't there's more legwork involved. Homebrew does not make it easy to install previous versions of formulae.Here's how I did it:
git -C $(brew --repo homebrew/core) fetch --unshallow
brew log icu4c
to track down a commit that references 62.1;575eb4b
does the trick.cd $(brew --repo homebrew/core)
git checkout 575eb4b -- Formula/icu4c.rb
brew uninstall --ignore-dependencies icu4c
brew install icu4c
You should now have the correct version of the dependency! Now just to...git reset && git checkout .
Cleanup your modified recipe.This fixed it for me: