skip to Main Content

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


  1. Reinstall libsodium using brew. It should fix the broken php installs.

    Run:
    brew reinstall libsodium

    Login or Signup to reply.
  2. In my case it happened after running brew upgrade. The error I received (after trying to execute composer install):

    dyld[75922]: Library not loaded: /usr/local/opt/libsodium/lib/libsodium.23.dylib
      Referenced from: <XXX> /usr/local/Cellar/php/8.2.7_1/bin/php
    

    I managed to fix it by reinstalling PHP 8.2:

    brew reinstall php
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search