Skip to content

Instantly share code, notes, and snippets.

@hgrimelid
Created August 17, 2018 07:36
Show Gist options
  • Save hgrimelid/703691ab48c4a4d0537cfe835b4d55a6 to your computer and use it in GitHub Desktop.
Save hgrimelid/703691ab48c4a4d0537cfe835b4d55a6 to your computer and use it in GitHub Desktop.
php: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.61.dylib

After upgrading to Node v.10.9.0 via Homebrew the following error message was thrown from PHP:

dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.61.dylib
  Referenced from: /usr/local/bin/php
  Reason: image not found

Reinstall PHP to fix, for me that's:

brew reinstall [email protected]

@kythuatwebso
Copy link

For MacOS Mojave 10.14.6 and
dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.64.dylib
help this:
brew reinstall https://raw.githubusercontent.com/Homebrew/homebrew-core/a806a621ed3722fb580a58000fb274a2f2d86a6d/Formula/icu4c.rb

This worked for me on catalina 10.15.5 as well!

This worked php 5.6 but error 7.3 :( How to worked two version 5.6 & 7.3?

@oguzhan80
Copy link

The reinstall works for me to get php 5.6, 7.0, 7.1, 7.2 running - but not 7.3 and <=7.1 together :(

@roskoshinsky
Copy link

roskoshinsky commented May 28, 2020

The reinstall works for me to get php 5.6, 7.0, 7.1, 7.2 running - but not 7.3 and <=7.1 together :(

  1. stop all php-fpm services
  2. brew reinstall https://raw.githubusercontent.com/Homebrew/homebrew-core/a806a621ed3722fb580a58000fb274a2f2d86a6d/Formula/icu4c.rb
  3. copy libicui18n.64.dylib from /usr/local/opt/icu4c/lib/ (MacOS, Mojave, 10.14.6) to save any location
  4. brew reinstall icu4c
  5. ls -al /usr/local/opt/icu4c/lib/ - you have to see libicui18n.66* and absent libicui18n.64.dylib
  6. copy libicui18n.64.dylib back to /usr/local/opt/icu4c/lib/
  7. start your php-fpm services
  8. if some troubles with php-fpm – see logs at /usr/local/var/log/php-fpm.log (probably location)

@kythuatwebso
Copy link

The reinstall works for me to get php 5.6, 7.0, 7.1, 7.2 running - but not 7.3 and <=7.1 together :(

  1. stop all php-fpm services
  2. brew reinstall https://raw.githubusercontent.com/Homebrew/homebrew-core/a806a621ed3722fb580a58000fb274a2f2d86a6d/Formula/icu4c.rb
  3. copy libicui18n.64.dylib from /usr/local/opt/icu4c/lib/ (MacOS, Mojave, 10.14.6) to save any location
  4. brew reinstall icu4c
  5. ls -al /usr/local/opt/icu4c/lib/ - you have to see libicui18n.66* and absent libicui18n.64.dylib
  6. copy libicui18n.64.dylib back to /usr/local/opt/icu4c/lib/
  7. start your php-fpm services
  8. if some troubles with php-fpm – see logs at /usr/local/var/log/php-fpm.log (probably location)

Thanks Bro, PHP 5.6 vs PHP 7.3 is works ok.

But not just copying 1 file, but copying multiple files with the same file name libicu * .64.dylib

image

@kythuatwebso
Copy link

@oguzhan80 Please fix by the above will work

@roskoshinsky
Copy link

Thanks Bro, PHP 5.6 vs PHP 7.3 is works ok.
But not just copying 1 file, but copying multiple files with the same file name libicu * .64.dylib

Your welcome, Bro. But I copied the one file exactly. May be some difference with OS and your advice will help some other.
6b176(1)

@leonardodevbr
Copy link

For MacOS Mojave 10.14.6 and

dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.64.dylib

help this:

brew reinstall https://raw.githubusercontent.com/Homebrew/homebrew-core/a806a621ed3722fb580a58000fb274a2f2d86a6d/Formula/icu4c.rb

This worked for me on Catalina 10.15.5 as well!

@haris4063
Copy link

For MacOS Mojave 10.14.6 and

dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.64.dylib

help this:

brew reinstall https://raw.githubusercontent.com/Homebrew/homebrew-core/a806a621ed3722fb580a58000fb274a2f2d86a6d/Formula/icu4c.rb

Worked like a charm on catalina

@alanpachuau
Copy link

For MacOS Mojave 10.14.6 and

dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.64.dylib

help this:

brew reinstall https://raw.githubusercontent.com/Homebrew/homebrew-core/a806a621ed3722fb580a58000fb274a2f2d86a6d/Formula/icu4c.rb

Works great for php7.1 on Mac OS Catalina

@mmbakker
Copy link

For MacOS Mojave 10.14.6 and

dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.64.dylib

help this:

brew reinstall https://raw.githubusercontent.com/Homebrew/homebrew-core/a806a621ed3722fb580a58000fb274a2f2d86a6d/Formula/icu4c.rb

Thanks so much!
Worked here for PHP 7.1 on Catalina 10.15.5.

@jeanbispo
Copy link

For MacOS Mojave 10.14.6 and

dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.64.dylib

help this:

brew reinstall https://raw.githubusercontent.com/Homebrew/homebrew-core/a806a621ed3722fb580a58000fb274a2f2d86a6d/Formula/icu4c.rb

wow tks, worked for me with php 7.3 and php 5.6 on Catalina 10.15.5

@omargavidia
Copy link

4. brew reinstall icu4c

It worked for me with the following features: Mac OS Catalina Version 10.15.6 and PHP 7.4.9 (cli) (built: Aug 7 2020 19:23:06)

@shuvoenr
Copy link

shuvoenr commented Sep 7, 2020

  1. brew reinstall icu4c

It worked for me with the following features: Mac OS Catalina Version 10.15.6 and PHP 7.4.9 (cli) (built: Aug 7 2020 19:23:06)

This is worked for me.

@Muffinman
Copy link

This does't work for me on Catalina:

 ! ~ > brew reinstall https://raw.githubusercontent.com/Homebrew/homebrew-core/a806a621ed3722fb580a58000fb274a2f2d86a6d/Formula/icu4c.rb
Error: Calling Installation of icu4c from a GitHub commit URL is disabled! Use 'brew extract icu4c' to stable tap on GitHub instead.

@guillaumebihet
Copy link

guillaumebihet commented Sep 15, 2020

I had the same issue here, running brew reinstall icu4c
Error: Calling Installation of icu4c from a GitHub commit URL is disabled! Use 'brew extract icu4c' to stable tap on GitHub instead.

The solution for me was to run it while being in php 7.2, then switch back to 7.1:
brew install [email protected]
brew unlink [email protected]
brew link [email protected] --force
brew reinstall icu4c
brew unlink [email protected]
brew link [email protected] --force

@sultanos
Copy link

After reinstalling php , nothing worked , so I had to do
export PATH="/usr/local/opt/[email protected]/bin:$PATH" >> ~/.zshrc
Then it my php artisan serve worked back

@eszel
Copy link

eszel commented Oct 24, 2020

For me, "brew reinstall icu4c" configured and "make"-ed php7.1 for the newer icu4c.. problem solved! :)

@damiancastelao
Copy link

For me, upgrade node (brew upgrade node) from 13.6.0 to v15.2.0 solved the problem
macOS catalina 10.15.7

@Ardakilic
Copy link

If you cannot reinstall from url, simply download and use the local file.

Instead of

brew reinstall https://raw.githubusercontent.com/Homebrew/homebrew-core/a806a621ed3722fb580a58000fb274a2f2d86a6d/Formula/icu4c.rb

Simply do something like

wget https://raw.githubusercontent.com/Homebrew/homebrew-core/a806a621ed3722fb580a58000fb274a2f2d86a6d/Formula/icu4c.rb
brew reinstall icu4c.rb

@jv2222
Copy link

jv2222 commented Feb 10, 2021

Expanding on @Ardakilic's comment:

To be even more explicit and break down what is going on here:

  1. Go here in your web browser:
    https://raw.githubusercontent.com/Homebrew/homebrew-core/a806a621ed3722fb580a58000fb274a2f2d86a6d/Formula/icu4c.rb

  2. Copy paste the contents into a text file named:
    icu4c.rb

  3. Run:
    brew reinstall icu4c.rb

I just write this to make it clear it's only a text file being downloaded, not rocket surgery.

(I was stumped on this for a while until I looked at contents of the .rb files)

@Ardakilic
Copy link

Ardakilic commented Feb 10, 2021

Update Hopefully now I have a proper solution for this. @jv2222 you should also check this:

Icu4c reinstallation made me force reinstall PHP8, which broke the purpose for me. So, I have found some new repositories where you don't need to hassle with this icu4c stuff at all:

brew install shivammathur/php/[email protected]
brew install shivammathur/php/[email protected]
brew install shivammathur/php/[email protected]
brew install shivammathur/php/[email protected]
brew install shivammathur/php/[email protected]
brew install shivammathur/php/[email protected]
brew install shivammathur/php/[email protected]

First, delete all php installations with a command something like brew uninstall "php*" and brew unlink [email protected]

You may also need to untap other taps. I had to run

brew untap exolnet/deprecated

to install properly.

Then, if you want, delete the /usr/local/etc/php folder

then install one of the packages I've linked above.

Worked Nicely for PHP 7.1:

➜  ~ php -v
PHP 7.1.33 (cli) (built: Dec  1 2020 01:14:43) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.1.33, Copyright (c) 1999-2018, by Zend Technologies

You can also quickly switch between php versions with a command like:

brew unlink php && brew link --overwrite --force [email protected]

etc.

The GitHub repository: https://github.com/shivammathur/homebrew-php

The source where I found these packages: here.

I also shared this answer back here in SO: https://stackoverflow.com/questions/60128044/error-while-installing-php-7-1-for-mac-with-homebrew/65438579#65438579

@ninjachen
Copy link

In my case, reinstallation [email protected] didn't work. I downgrade the icu4c from 67 to 64 by this document

@EdieLemoine
Copy link

@Ardakilic Thank you, your solution worked for me on MacOS 11.2.2.

@Ardakilic
Copy link

@EdieLemoine glad that helped. I've been using that very repository for PHP7.1-7.4 over the time, without issues.

@gonzalogcontacto
Copy link

brew reinstall php@[YOUR_VERSION] is working 👍

@joneiros
Copy link

joneiros commented May 6, 2021

[email protected] (PHP 7.3.28)
Initial suggestion of PHP reinstall worked!

Error:

dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.68.dylib
  Referenced from: /usr/local/opt/[email protected]/bin/php
  Reason: image not found

Caused by: icu4c updated to 69.1 from another brew install.

Solution: brew reinstall [email protected]

Thank you OP!

@saw-gain
Copy link

saw-gain commented May 18, 2021

Hi,
I am getting this warning when installing the php on macOS Big sur

  dyld: Library not loaded: /usr/local/opt/openldap/lib/libldap-2.5.0.dylib
  Referenced from: /usr/local/Cellar/php/8.0.6/bin/php
  Reason: image not found

brew reinstalling did not work. Can anyone please help?

thank you!

@Ardakilic
Copy link

@saw-gain please check my comment here. I've been using these packages without issues.

@vamaship-saud-qureshi
Copy link

vamaship-saud-qureshi commented Jun 9, 2022

Update Hopefully now I have a proper solution for this. @jv2222 you should also check this:

Icu4c reinstallation made me force reinstall PHP8, which broke the purpose for me. So, I have found some new repositories where you don't need to hassle with this icu4c stuff at all:

brew install shivammathur/php/[email protected]
brew install shivammathur/php/[email protected]
brew install shivammathur/php/[email protected]
brew install shivammathur/php/[email protected]
brew install shivammathur/php/[email protected]
brew install shivammathur/php/[email protected]
brew install shivammathur/php/[email protected]

First, delete all php installations with a command something like brew uninstall "php*" and brew unlink [email protected]

You may also need to untap other taps. I had to run

brew untap exolnet/deprecated

to install properly.

Then, if you want, delete the /usr/local/etc/php folder

then install one of the packages I've linked above.

Worked Nicely for PHP 7.1:

➜  ~ php -v
PHP 7.1.33 (cli) (built: Dec  1 2020 01:14:43) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.1.33, Copyright (c) 1999-2018, by Zend Technologies

You can also quickly switch between php versions with a command like:

brew unlink php && brew link --overwrite --force [email protected]

etc.

The GitHub repository: https://github.com/shivammathur/homebrew-php

The source where I found these packages: here.

I also shared this answer back here in SO: https://stackoverflow.com/questions/60128044/error-while-installing-php-7-1-for-mac-with-homebrew/65438579#65438579

@Ardakilic
Thanks a lot man.
This was helpful

@sid3r
Copy link

sid3r commented Sep 19, 2023

Reinstalling and compiling from source fixed the issue for me

brew reinstall --build-from-source php

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment