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
in my case, I reinstall all packages installed with Homebrew
$ brew list | xargs brew reinstall
After that, I start to install my version that I need
I had problems because my version of PHP (7.3) was expecting icu4c 63 and brew would only install 64.
https://stackoverflow.com/a/55828190/2000947 helped me install 63.
I had the same problem after I upgraded my macOS
to version 10.13.6
. I can't run composer
and php
commands. After researching for a while and trying various solutions posted online, reinstalling php using homebrew
worked.
brew reinstall php@7.1
Added on March 14th based on Ryan's comment
get the version you are currently using by running php -v
and get the right formulae (which you can find here: https://formulae.brew.sh/formula/php) to replace @7.1
in the above command.
On OSX 10.15.4 running xcode-select --install
fixed the issue for me.
For me, it was installing icu4c with the needed version.
If you need to install the old version like version 62, (same steps for else versions), you need to:
https://raw.githubusercontent.com/Homebrew/homebrew-core/575eb4bbef683551e19f329f60456b13a558132f/Formula/icu4c.rb
https://raw.githubusercontent.com/Homebrew/homebrew-core/a806a621ed3722fb580a58000fb274a2f2d86a6d/Formula/icu4c.rb
https://raw.githubusercontent.com/Homebrew/homebrew-core/22fb699a417093cd1440857134c530f1e3794f7d/Formula/icu4c.rb
https://raw.githubusercontent.com/Homebrew/homebrew-core/88b9cc789820f2f544d8d4a1053eebb044c2926c/Formula/icu4c.rb
brew tap [yourUsername]/homebrew-versions
brew install [yourUsername]/homebrew-versions/icu4c
Where [yourUsername] is the name of your GitHub account or person who already have the needed version tap.
Unfortunately, latest homebrew gives no longer a warning and now displays the error: Error: Calling Installation of XXX from a GitHub commit URL is disabled! Use 'brew extract XXX' to stable tap on GitHub instead. So the way to go now is to create a new repo on github called homebrew-versions to host the Formula in a Tap Then initialise it with: brew tap-new MYORG/homebrew-versions after git cloning the homebrew repo as suggested by Shine Hugh, copy paste the raw ruby file to your new Formula. Beware the funny naming convention! Example: File name is: gettext@0.20.2.rb Class name is: GettextAT0202 Example: https://github.com/nedap/homebrew-versions
source:https://itnext.io/how-to-install-an-older-brew-package-add141e58d32
This is what finally worked for me.
brew reinstall postgres
After running the above command you might need to run
brew postgresql-upgrade-database
to access your previous data.