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
On MacOS Mojave, only way I could fix it was with brew upgrade
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
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:
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
ln -s /usr/local/icu4c/62.1/lib/*.dylib /usr/local/include/
DYLD_LIBRARY_PATH
in ~/.bash_profile
:export DYLD_LIBRARY_PATH=/usr/local/include
The solution in this gist did it for me
brew uninstall --ignore-dependencies node icu4c
brew install node
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
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.