我的MAC操作系统是Yosemite 10.10,它有旧版本的curl。我已经安装了 Xcode 和 Xcode 命令行工具。
I run cURL with the "sudo" command as “sudo curl”:
sudo curl
Password:
curl: try 'curl --help' or 'curl --manual' for more information
However, when I run curl under the common user in the the terminal, it failed as follows:
dyld: Library not loaded: /usr/lib/libcurl.4.dylib
Referenced from: /usr/bin/curl
Reason: Incompatible library version: curl requires version 7.0.0 or later, but libcurl.4.dylib provides version 5.0.0
Trace/BPT trap: 5
I also downloaded the curl version of 7.43, and installed in /usr/local/bin.
— "which curl” shows “/usr/local/bin/curl”
— otool shows:
otool -L /usr/local/bin/curl
/usr/local/bin/curl:
/usr/local/lib/libcurl.4.dylib (compatibility version 8.0.0, current version 8.0.0)
/usr/lib/libssl.0.9.8.dylib (compatibility version 0.9.8, current version 0.9.8)
/usr/lib/libcrypto.0.9.8.dylib (compatibility version 0.9.8, current version 0.9.8)
/System/Library/Frameworks/LDAP.framework/Versions/A/LDAP (compatibility version 1.0.0, current version 2.4.0)
/usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.5)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1213.0.0)
otool -L /usr/local/lib/libcurl.4.dylib
/usr/local/lib/libcurl.4.dylib:
/usr/local/lib/libcurl.4.dylib (compatibility version 8.0.0, current version 8.0.0)
/usr/lib/libssl.0.9.8.dylib (compatibility version 0.9.8, current version 0.9.8)
/usr/lib/libcrypto.0.9.8.dylib (compatibility version 0.9.8, current version 0.9.8)
/System/Library/Frameworks/LDAP.framework/Versions/A/LDAP (compatibility version 1.0.0, current version 2.4.0)
/usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.5)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1213.0.0)
然而,curl 仍然适用于“sudo”,但对于普通用户来说失败了,即
dyld: Library not loaded: /usr/local/lib/libcurl.4.dylib
Referenced from: /usr/local/bin/curl
Reason: Incompatible library version: curl requires version 8.0.0 or later, but libcurl.4.dylib provides version 5.0.0
Trace/BPT trap: 5
同时,之前的解决方案(尝试使用自制软件安装curl,得到libcurl.4.dylib的“不兼容的库版本”)不适合我的情况。
- 更多的 - -
实际上,似乎调用 libcurl 的命令无法使用相同的信息运行,例如:
--Mac端口:
[user @MBK ~]$port
dlopen(/opt/local/libexec/macports/lib/pextlib1.0/Pextlib.dylib, 6): Library not loaded: /usr/lib/libcurl.4.dylib
Referenced from: /opt/local/libexec/macports/lib/pextlib1.0/Pextlib.dylib
Reason: Incompatible library version: Pextlib.dylib requires version 7.0.0 or later, but libcurl.4.dylib provides version 5.0.0
while executing "load /opt/local/libexec/macports/lib/pextlib1.0/Pextlib.dylib"
("package ifneeded Pextlib 1.0" script)
invoked from within "package require Pextlib 1.0"
(file "/opt/local/bin/port" line 47)
-- 网络CDF:
[user@MBK ~]$ncdump
dyld: Library not loaded: /opt/local/lib/libcurl.4.dylib
Referenced from: /opt/local/bin/ncdump
Reason: Incompatible library version: ncdump requires version 8.0.0 or later, but libcurl.4.dylib provides version 5.0.0
Trace/BPT trap: 5
同样,带有“sudo”的命令可以工作。
答案1
我遇到了类似的问题,正在运行
curl http://some.site
给了
dyld: Library not loaded: @rpath/libssl.1.0.0.dylib
Referenced from: /Users/samh/anaconda3/lib/libssh2.1.dylib
Reason: image not found
然而,跑步conda install libssh2
解决了这个问题。这对我来说毫无意义,因为curl已经在我的机器上工作了很多年了......但至少现在它可以工作了。
答案2
理想情况下,您应该通过以下方式重新安装curl
:brew reinstall curl
以便重新链接不兼容的库(.dylib
文件)。
如果没有帮助,请仔细检查DYLD_LIBRARY_PATH
和DYLD_FALLBACK_LIBRARY_PATH
变量的值,因为配置错误的值可能会导致此类问题(例如检查您的~/.bashrc
)。理想情况下取消设置它们,否则如果未设置,请尝试将其设置为:
export DYLD_FALLBACK_LIBRARY_PATH="/usr/X11/lib:/usr/lib"
类似问题:Dylib 和 OS X。
答案3
要么你有两个问题,要么一个讨厌的问题,要找出哪一个类型的命令,sudo sh -c 'type curl';type curl
如果两种类型的命令显示相同的文件,你会遇到困难,但可能你有两个更简单的问题:curl安装了两次,并且你的动态链接器配置错误。
答案4
我最近从 python 3.6 迁移到 3.7。我相当确定在那之前卷曲就起作用了。解决问题的事实conda install libssh2
让我认为 python 升级是破坏curl 的原因。这或许就是这样的解释萨姆·H缺失,即“……对我来说没有意义……”。