Installing curl with http3 on MacOS

gjrdiesel

Justin

Posted on October 8, 2020

Installing curl with http3 on MacOS

When you are all said and done with this tutorial, you'll be able to double check http3 support via the curl command like this:

curl --http3 https://cloudflare-quic.com -I
HTTP/3 200
date: Fri, 24 Jul 2020 08:10:24 GMT
content-type: text/html
content-length: 106072
set-cookie: __cfduid=d8647a359d68a89c060bde4f373e18cc61595578224; expires=Sun, 23-Aug-20 08:10:24 GMT; path=/; domain=.cloudflare-quic.com; HttpOnly; SameSite=Lax; Secure
cf-request-id: 042178a64b0000188b7b1d9200000001
expect-ct: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
server: cloudflare
cf-ray: 5b7c2a1d4eb5188b-MAN
alt-svc: h3-27=":443"; ma=86400, h3-28=":443"; ma=86400, h3-29=":443"; ma=86400
Enter fullscreen mode Exit fullscreen mode

Unfortunately, this currently involves building curl from source, luckily for us, cloudflare makes this even easier.

# Clean up any old version of curl you may have already tried to install
brew remove -f curl

# Download the curl ruby install script provided by cloudflare
wget https://raw.githubusercontent.com/cloudflare/homebrew-cloudflare/master/curl.rb

# Install curl via that script from the latest git repos
brew install --HEAD -s curl.rb

# Tell your cli to use the curl version just installed (if you're using zsh, othwerise you might need `~/.bashrc`)
echo 'export PATH="/usr/local/opt/curl/bin:$PATH"' >> ~/.zshrc

# Reload your config
source ~/.zshrc

# Double check it's using the right curl
which curl # Should output "/usr/local/opt/curl/bin/curl"

# Double check http3
$ curl --version | grep HTTP3
  Features: alt-svc AsynchDNS brotli HTTP2 HTTP3 IDN IPv6 Largefile libz MultiSSL NTLM NTLM_WB SSL UnixSockets zstd

# Try curl on any HTTP/3 enabled sites.
curl --http3 https://blog.cloudflare.com -I
Enter fullscreen mode Exit fullscreen mode

Have fun upgrading all the servers!

💖 💪 🙅 🚩
gjrdiesel
Justin

Posted on October 8, 2020

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related