VSCode中使用Agda时libicuuc.73.dylib依赖加载失败求助
错误信息
dyld[9071]: Library not loaded: @loader_path/dylib/libicuuc.73.dylib
Referenced from: <41CE9F56-E2D2-3C41-8137-4FCDB6FDAE40> /Users/mac/Library/Application Support/Code/User/globalStorage/banacorn.agda-mode/v0.2.6.4.0.3-darwin/als
Reason: tried: '/Users/mac/Library/Application Support/Code/User/globalStorage/banacorn.agda-mode/v0.2.6.4.0.3-darwin/dylib/libicuuc.73.dylib' (not a mach-o file), '/usr/local/lib/libicuuc.73.dylib' (no such file), '/usr/lib/libicuuc.73.dylib' (no such file, not in dyld cache)
[Error - 3:38:36 AM] Server initialization failed.
Message: Pending response rejected since connection got disposed
Code: -32097
[Error - 3:38:36 AM] Agda Language Server client: couldn't create connection to server.
Message: Pending response rejected since connection got disposed
Code: -32097
解决方案(按顺序尝试)
方案一:通过Homebrew安装对应版本ICU库
- 打开「终端」应用(在Launchpad的「其他」文件夹内)
- 未安装Homebrew的话,输入以下命令并回车安装:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" - 安装完成后,输入命令安装ICU 73版本:
brew install icu4c@73 - 创建软链接让系统识别该库(输入后需输入电脑密码,终端不会显示输入内容,直接回车即可):
sudo ln -s /usr/local/opt/icu4c@73/lib/libicuuc.73.dylib /usr/local/lib/libicuuc.73.dylib sudo ln -s /usr/local/opt/icu4c@73/lib/libicui18n.73.dylib /usr/local/lib/libicui18n.73.dylib sudo ln -s /usr/local/opt/icu4c@73/lib/libicuio.73.dylib /usr/local/lib/libicuio.73.dylib sudo ln -s /usr/local/opt/icu4c@73/lib/libicudata.73.dylib /usr/local/lib/libicudata.73.dylib - 重启VSCode测试。
方案二:修复Agda扩展目录内的损坏库文件
- 终端输入命令进入Agda扩展的库文件目录:
cd "/Users/mac/Library/Application Support/Code/User/globalStorage/banacorn.agda-mode/v0.2.6.4.0.3-darwin/dylib" - 删除损坏的库文件:
rm libicuuc.73.dylib - 从Homebrew安装目录复制正确文件:
cp /usr/local/opt/icu4c@73/lib/libicuuc.73.dylib . - 重启VSCode测试。
方案三:更换Agda扩展版本
- 在VSCode「扩展」面板找到「Agda Mode」
- 点击扩展卡片右下角齿轮图标,选择「安装另一个版本」
- 选择更早或稍新的版本(如v0.2.6.3.x.x)安装,重启VSCode测试。
内容的提问来源于stack exchange,提问作者Rmal

