Ben
Ben

Reputation: 393

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

Upvotes: 17

Views: 46444

Answers (7)

mmuecke
mmuecke

Reputation: 151

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.

Upvotes: 2

user15883262
user15883262

Reputation: 21

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

Upvotes: 1

Birkhoff Lee
Birkhoff Lee

Reputation: 860

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.

Upvotes: 39

David Beckershoff
David Beckershoff

Reputation: 11

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.

Upvotes: 1

Punnerud
Punnerud

Reputation: 8021

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/

Upvotes: 5

Surya Chhetri
Surya Chhetri

Reputation: 11568

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

Upvotes: 13

Ben
Ben

Reputation: 393

SOLUTION:

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

./configure --with-darwinssl

Upvotes: 7

Related Questions