MacOS – How to get curl to work with SSL endpoints

command linehigh sierramacos

I continue to get the following error when trying to curl an https:// endpoint:

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

I've tried manually installing with --with-darwinssl:

wget https://curl.haxx.se/download/curl-7.58.0.zip
unzip curl-7.58.0.zip
cd curl-7.58.0
./configure --with-darwinssl
make
sudo make install

I think this is installing to /usr/bin/curl but I've tried this one as well as what's in /usr/local/bin/curl and continue to get the same result. From the -V details, it seems like SSL should be enabled:

/usr/bin/curl -V
curl 7.54.0 (x86_64-apple-darwin17.0) libcurl/7.54.0 LibreSSL/2.0.20 zlib/1.2.11 nghttp2/1.24.0
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp smb smbs smtp smtps telnet tftp
Features: AsynchDNS IPv6 Largefile GSS-API Kerberos SPNEGO NTLM NTLM_WB SSL libz HTTP2 UnixSockets HTTPS-proxy

I've also tried:

brew uninstall --force curl
brew cleanup --force -s curl
brew prune
brew install curl --with-openssl

But no luck. I'm about out of ideas here, any help is appreciated

Best Answer

Protocol "“https" not supported
          ^

See that extra quotation mark? That's a curly quote, not a normal double quote. curl thinks the protocol is literally called “https.

I bet you copy/pasted a URL from a web page which included that symbol and curl is trying to interpret it as part of the protocol. Remove it, and curl should start working as expected.