mac php dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.64.dylib 亲测有效

php -v 报错如下

dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.64.dylib
  Referenced from: /usr/local/opt/php@7.1/bin/php
  Reason: image not found
Abort trap: 6

网上有很多坑铁的教程,试了很多然而并没有什么卵用

最终找到了一篇

https://blog.csdn.net/jmdxin/article/details/114970739?utm_medium=distribute.pc_relevant.none-task-blog-baidujs_title-0&spm=1001.2101.3001.4242

不管用的icu版本是多少,方法都是一样的,大家可根据自己的实际情况修改版本号

注意:由于权限可能不同,文中 make && make install,可能需要拆分为

sudo  make

sudo make install

否则可能报如下错误

mkdir /usr/local/icu4c
mkdir: /usr/local/icu4c: Permission denied
mkdir /usr/local/icu4c/64.2
mkdir: /usr/local/icu4c: No such file or directory
mkdir /usr/local/icu4c/64.2/lib
mkdir: /usr/local/icu4c/64.2: No such file or directory
make[1]: *** [install-library] Error 1
make: *** [install-recursive] Error 2

最后复制命令要加上这句,引用文中没写

sudo cp libicuuc.64.dylib /usr/local/opt/icu4c/lib/libicuuc.64.dylib 

用这个方法从68.2 ->64.2 成功降下来了,预祝你们也少走一些弯路

XXXXX $ php -v
PHP 7.1.33 (cli) (built: Dec 19 2019 11:01:14) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies
    with Xdebug v2.9.8, Copyright (c) 2002-2020, by Derick Rethans
    with Zend OPcache v7.1.33, Copyright (c) 1999-2018, by Zend Technologies

上一篇:mkdir


下一篇:2021-02-25