16

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
Ben
  • 383
  • 1
  • 2
  • 10

7 Answers7

39

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.

Birkhoff Lee
  • 788
  • 10
  • 21
  • 2
    This is the info I needed and it shouldn't be at the bottom of the page! Everyone else says to use the "--with-openssl" option which is no longer possible. Further, I also had to turn off my antivirus as it was blocking connections to be able to download the cURL packages. – Jono Sep 01 '19 at 09:53
  • 3
    just to add that after this you need to close the terminal and reopen it. A hour that I won't get back.. – Witterquick Sep 04 '19 at 11:42
  • 3
    FYI - in 2021, it is proposed to install openssl curl with `brew install curl`, see this thread: https://github.com/Homebrew/discussions/discussions/1268 – its_a_paddo Apr 13 '21 at 14:23
12

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
Surya
  • 11,002
  • 4
  • 57
  • 39
  • This is a better answer than Ben's and deserves to be accepted. (Vadym Tyemirov's answer didn't work for me.) – Daryl Spitzer Dec 05 '18 at 21:07
  • 1
    (for others with similarly lackluster shell skills...) you need to cd into the unzipped curl directory before you can run ./configure --with-darwinssl :-) – Spookytheboy Dec 03 '19 at 22:23
  • When run `./configure --with-darwinssl` there is an error occurred. `configure: error: C compiler cannot create executables` – SHUMING LU Jun 14 '20 at 13:10
7

SOLUTION:

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

./configure --with-darwinssl
Ben
  • 383
  • 1
  • 2
  • 10
  • `-bash: ./configure: No such file or directory`- WHAT TO DO? My Bounty:http://stackoverflow.com/questions/39287906/error-while-installing-firebase-via-cocoapods/39300838?noredirect=1#comment65998448_39300838 – Bista Sep 05 '16 at 15:48
  • 2
    where is curl installed on mac please ? – JoaMika Sep 16 '16 at 13:03
5

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/

Vadym Tyemirov
  • 8,288
  • 4
  • 42
  • 38
Punnerud
  • 7,195
  • 2
  • 54
  • 44
1

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.

  • Removed the quotations and made the link to be like `curl https://example.com` instead of `curl "https://example.com"` and it worked. Thanks! – Seeya May 05 '19 at 08:25
1

For anyone that stumbles upon this in 2021 and later using Xcode 12+ attempting to build their project via commandline and doesn't want to rely on 'brew' or other package managers...

I was hitting the ./configure: No such file or directory issue after getting the curl source from github.

The source from github is missing the configure exec. that you need to generate your makefiles

Apple provides the curl source along with required MacOS/iOS build settings in their Open Source Browser:

https://opensource.apple.com/source/curl/

https://opensource.apple.com/release/macos-112.html

  1. Download & unpack the source

  2. Set your env variables - 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"

  3. cd to the /curl directory

  4. run: ./configure --with-darwinssl

My use case is building an iOS app on a hosted macOS build agent in Azure DevOps

0

An updated solution in 2023 for Ventura. First you want to install openssl and then curl with brew:

brew install openssl
brew install curl

Afterwards you need to export the installed curl version to your zsh or whatever shell you using, with the following (change path to /usr/local if running on Intel):

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

Then just check with curl -V the available protocols, where you should see https, sftp, etc.

mmuecke
  • 121
  • 5