如何在Mac OS X上启用curl SSL?

niknxzdl  于 2023-04-30  发布在  Mac
关注(0)|答案(7)|浏览(335)

我在Mac OS X 10上使用终端。11.2,我不能处理任何https请求。我总是得到这个错误:

curl: (1) Protocol "https" not supported or disabled in libcurl

我尝试了这个,但我得到了一个“错误目录”错误:

./configure --with-ssl=/usr/local/ssl

任何建议都会有帮助。

编辑:

这是我在尝试使用ssl安装时遇到的错误:

configure: error: OpenSSL libs and/or directories were not found where specified!

解决方案:

适用于Mac OS X 10。6或更高版本使用此选项来启用SSL:

./configure --with-darwinssl
j13ufse2

j13ufse21#

Homebrew团队最近删除了cURL公式的所有安装选项,这意味着你现在将无法执行brew install curl --with-openssl。相反,执行brew install curl-openssl。请确保先卸载旧的brew uninstall curl

wztqucjr

wztqucjr2#

以下步骤有助于解决问题:(注意:libcurl将被重建)

# First simply remove curl and try reinstall with openssl:
brew rm curl && brew install curl --with-openssl # Rerun

如果没有修复,下载并重建libcurl,按照以下步骤,这帮助我修复了这个问题

# Download curl from : https://curl.haxx.se/download.html
wget https://curl.haxx.se/download/curl-7.58.0.zip  # or, wget https://curl.haxx.se/download/curl-*.*.*
unzip curl-7.58.0.zip  # or, unzip curl-*.*.*

./configure --with-darwinssl  # However for Linux(ubuntu): ./configure --with-ssl 
make
sudo make install  # Rerun the program
hmae6n7t

hmae6n7t3#

解决方案:

适用于Mac OS X 10。6或更高版本使用此选项来启用SSL:

./configure --with-darwinssl
llmtgqce

llmtgqce4#

通过将标准curl替换为支持nghttp2的curl解决了这个问题(需要brew)

brew install curl --with-nghttp2
brew link curl --force

包括--http2
例如:

curl --http2 https://www.example.com

或:

curl --header 'Access-Token: o.bFbpTuazstlUZXsnyTWTaJq0biZ' \
--http2 https://www.example.com/

参考:https://daniel.haxx.se/blog/2016/08/01/curl-and-h2-on-mac/https://simonecarletti.com/blog/2016/01/http2-curl-macosx/

qltillow

qltillow5#

我犯了一个新手错误,把URL加在引号中(curl -v -k“https://URL.com“)。将链接放入撇号(curl -v -k 'https://URL.com')后,curl接受了https URL。

zour9fqk

zour9fqk6#

对于任何在2021年以及之后使用Xcode 12+尝试通过命令行构建项目并且不想依赖'brew'或其他包管理器的人来说。..
我在从github获得curl源代码后遇到了./configure: No such file or directory问题。

来自github的源代码缺少configure exec。你需要生成你的makefile

Apple在其开源浏览器中提供了curl源沿着所需的MacOS/iOS构建设置:
https://opensource.apple.com/source/curl/
https://opensource.apple.com/release/macos-112.html
1.下载并解压缩源代码
1.设置你的环境变量-Apple Platforms (macOS, iOS, tvOS, watchOS, and their simulator counterparts)
export ARCH=arm64
export SDK=iphoneos
export DEPLOYMENT_TARGET=11.0
export CFLAGS="-arch $ARCH -isysroot $(xcrun -sdk $SDK --show-sdk-path) -m$SDK-version-min=$DEPLOYMENT_TARGET"

  1. cd到/curl目录
    1.运行:./configure --with-darwinssl
    我的用例是在Azure DevOps中的托管macOS构建代理上构建iOS应用程序
6uxekuva

6uxekuva7#

Ventura在2023年的更新解决方案。首先你要安装openssl,然后用brew安装curl:

brew install openssl
brew install curl

然后,您需要将安装的curl版本导出到zsh或您使用的任何shell,并使用以下命令(如果在英特尔上运行,请将路径更改为/usr/local):

export PATH="/opt/homebrew/opt/curl/bin:$PATH"' >> ~/.zshrc

然后用curl -V检查可用的协议,你应该会看到https,sftp等。

相关问题