Adding http2 support to curl on macOS

By default, Sierra ships with curl 7.49.1:

sterling:~ nrj$ /usr/bin/curl --version
curl 7.49.1 (x86_64-apple-darwin16.0) libcurl/7.49.1 SecureTransport zlib/1.2.8
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 UnixSockets

While this version of curl did ship with http2 support protocol support is not baked in with the version Apple compiled.

Have no fear - curl can be installed with http2 support via brew.

brew install nghttp2
brew install curl --with-nghttp2

The only caveat (due to curl being key-only, and not symlinkned into /usr/local/bin) is that you’ll need to access the binary through the Cellar, e.g. /usr/local/Cellar/curl/7.51.0/bin/curl.