0

I ran brew upgrade on my Mac yesterday, and it upgraded PHP from 7.4 to 8.2. Then I found that the version of deployer we're using is not compatible with this, so I wanted to revert to 7.4.

I tried

brew unlink php
php link --overwrite php@7.4

Now when I try to use PHP I get a fatal error:

dyld[18837]: Library not loaded: /usr/local/opt/icu4c/lib/libicuio.71.dylib
  Referenced from: <F476B085-3588-359F-93EC-858DAE98B0D9> /usr/local/Cellar/php@7.4/7.4.32/bin/php
  Reason: tried: '/usr/local/opt/icu4c/lib/libicuio.71.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/usr/local/opt/icu4c/lib/libicuio.71.dylib' (no such file), '/usr/local/opt/icu4c/lib/libicuio.71.dylib' (no such file), '/usr/local/lib/libicuio.71.dylib' (no such file), '/usr/lib/libicuio.71.dylib' (no such file, not in dyld cache), '/usr/local/Cellar/icu4c/73.2/lib/libicuio.71.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/usr/local/Cellar/icu4c/73.2/lib/libicuio.71.dylib' (no such file), '/usr/local/Cellar/icu4c/73.2/lib/libicuio.71.dylib' (no such file), '/usr/local/lib/libicuio.71.dylib' (no such file), '/usr/lib/libicuio.71.dylib' (no such file, not in dyld cache)
Abort trap: 6

How do I fix this?

I tried brew upgrade icu4c and it said

Warning: icu4c 73.2 already installed

and didn't do anything. I tried brew reinstall icu4c and it said

==> Fetching icu4c
==> Downloading https://ghcr.io/v2/homebrew/core/icu4c/manifests/73.2
Already downloaded: /Users/admin/Library/Caches/Homebrew/downloads/2e5082de52a2c85ae665e51f8d0de0651611397cb02f4b4e2bb37898ba52a629--icu4c-73.2.bottle_manifest.json
==> Downloading https://ghcr.io/v2/homebrew/core/icu4c/blobs/sha256:4400e31a217d6ffcd2bd06e26ecbeed768133493bfcc4cb3c9ff9702f480beb6
Already downloaded: /Users/admin/Library/Caches/Homebrew/downloads/59a54cf8217aac6a125ca04a4da688bde25c1687a5bb1d057150fed83306ed33--icu4c--73.2.ventura.bottle.tar.gz
==> Reinstalling icu4c 
==> Pouring icu4c--73.2.ventura.bottle.tar.gz
  /usr/local/Cellar/icu4c/73.2: 268 files, 79.5MB
==> Running `brew cleanup icu4c`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
Warning: Formula curl-openssl was renamed to curl.
Warning: Formula curl-openssl was renamed to curl.
Warning: Formula curl-openssl was renamed to curl.
==> Upgrading 1 dependent of upgraded formula:
Disable this behaviour by setting HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
php@7.4 7.4.32 -> 7.4.33
Error: php@7.4 has been disabled because it is a versioned formula!
==> Checking for dependents of upgraded formulae...
Warning: Formula curl-openssl was renamed to curl.
==> Reinstalling 1 dependent with broken linkage from source:
php@7.3
Warning: Formula curl-openssl was renamed to curl.
Warning: Formula curl-openssl was renamed to curl.
Warning: Formula curl-openssl was renamed to curl.
Warning: Formula curl-openssl was renamed to curl.
==> Fetching php@7.3
==> Downloading https://www.php.net/distributions/php-7.3.13.tar.xz
Already downloaded: /Users/admin/Library/Caches/Homebrew/downloads/a309aced73f016a72175006c6ef58b58cc3b20604565410df57fd4807af65882--php-7.3.13.tar.xz
==> Reinstalling php@7.3 
Warning: Formula curl-openssl was renamed to curl.
Warning: Formula curl-openssl was renamed to curl.
Warning: Formula curl-openssl was renamed to curl.
Error: An exception occurred within a child process:
  FormulaUnavailableError: No available formula with the name "/usr/local/opt/php@7.3/.brew/php@7.3.rb".

Neither of these solved the php error.

I have a Time Machine backup, but so much stuff was upgraded yesterday that I have no idea what I need to restore.

Barmar
  • 741,623
  • 53
  • 500
  • 612
  • Does this answer your question? [dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.62.dylib error running php after installing node with brew on Mac](https://stackoverflow.com/questions/53828891/dyld-library-not-loaded-usr-local-opt-icu4c-lib-libicui18n-62-dylib-error-run) – Gugu72 Aug 09 '23 at 15:20
  • No, it just says `Warning: icu4c 73.2 already installed` – Barmar Aug 09 '23 at 15:25

1 Answers1

0

I finally solved it using the procedure at https://github.com/bridgebase/v3/blob/dev/docs/php-composer-macos-install.md

brew tap shivammathur/php
brew install shivammathur/php/php@7.4
Barmar
  • 741,623
  • 53
  • 500
  • 612