Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I enable curl SSL on Mac OS X?

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
like image 646
Ben Avatar asked Jan 21 '16 02:01

Ben


4 Answers

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.

like image 170
Birkhoff Lee Avatar answered Oct 09 '22 01:10

Birkhoff Lee


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
like image 37
Surya Avatar answered Oct 09 '22 03:10

Surya


SOLUTION:

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

./configure --with-darwinssl
like image 35
Ben Avatar answered Oct 09 '22 01:10

Ben


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/

like image 32
Punnerud Avatar answered Oct 09 '22 03:10

Punnerud