I have a few versions of php on my system(macOS):
7.4, 8.0, 8.1 and 8.2
I need to switch between these regularly for different projects.
I’ve run into a problem with laravel where when i try to run any valet commands when PHP7.4 is linked, i get the error message:
dyld[68591]: Library not loaded: /usr/local/opt/libsodium/lib/libsodium.23.dylib
It tries several folders and cannot find this version of libsodium, however libsodium.26.dylib exists.
I try to use brew to install libsodium 23 using:
brew install [email protected]
But get this message:
Warning: No available formula with the name "[email protected]". Did you mean libsodium?
edit:
So there is a slight mistake in that I thought the number in the libsodium dylib file corresponded to what version of libsodium was installed (I thought 1.0.26 was installed since the dylib file was called libsodium.26.dylib)
However this cannot be the case as the latest version of libsodium is 1.0.19.
This explains why ‘brew install [email protected]’ doesn’t work (as that version doesn’t exist yet).
In which case, how do I get valet to look for libsodium.26.dylib, rather than 23 like it is now?
2
Answers
Reinstall libsodium using brew. It should fix the broken php installs.
Run:
brew reinstall libsodium
In my case it happened after running
brew upgrade
. The error I received (after trying to executecomposer install
):I managed to fix it by reinstalling PHP 8.2: