Composer Update执行失败:找不到libunistring.2.dylib文件
解决Composer Update时libunistring依赖缺失问题
方案1:创建版本适配软链接
系统中已存在libunistring.5.dylib,可通过软链接让依赖它的libidn2找到指定版本:
- 先确认目标文件路径:
ls /usr/local/opt/libunistring/lib/
- 创建软链接:
sudo ln -s /usr/local/opt/libunistring/lib/libunistring.5.dylib /usr/local/opt/libunistring/lib/libunistring.2.dylib
- 完成后重新执行
composer update
方案2:重新安装依赖库
若软链接无效,直接重新安装相关库以修复版本依赖:
brew reinstall libunistring libidn2
安装完成后清理Composer缓存再重试:
composer clear-cache composer update
方案3:强制指定PHP环境运行Composer
确保Composer使用你配置的XAMPP PHP版本,直接用完整路径调用:
/Applications/xampp/xamppfiles/bin/php-8.1.4 $(which composer) update
($(which composer)会自动获取你的Composer实际路径,无需手动修改)
内容的提问来源于stack exchange,提问作者IanP
相关产品推荐
相关产品推荐

