How do I enable curl SSL on Mac OS X?

自作多情 提交于 2019-12-30 03:11:05

问题


I'm using Terminal on Mac OS X 10.11.2 and I can't process any https requests. I always get this error:

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

I tried this but I get a "wrong directory" error:

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

Any advice would be helpful.

EDIT:

This is the error I get when trying to install with ssl:

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

SOLUTION:

For Mac OS X 10.6 or later use this to enable SSL:

./configure --with-darwinssl

回答1:


Following steps helped fix the issue: (Note: libcurl will be rebuilt though)

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

If doesn't fix, download and rebuild libcurl with following steps, which helped me fix the issue

# 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



回答2:


SOLUTION:

For Mac OS X 10.6 or later use this to enable SSL:

./configure --with-darwinssl



回答3:


The Homebrew team has recently removed all install options for the cURL formula, which means you will not be able to do brew install curl --with-openssl now. Instead, do brew install curl-openssl. Make sure to uninstall the old one with brew uninstall curl first.




回答4:


Solved it by replacing standard curl with one with nghttp2 support (require brew)

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

include --http2 when doing request

example:

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

or:

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

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




回答5:


I made one rookie mistake by adding the URL within quotation marks (curl -v -k "https://URL.com"). After putting the link within apostrophes (curl -v -k 'https://URL.com') curl was accepting the https URL.



来源:https://stackoverflow.com/questions/34914473/how-do-i-enable-curl-ssl-on-mac-os-x

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!