How do I solve this problem and use cURL with HTTP/2 on Mac OS X or MacOS Sierra?
The default version of curl does not support HTTP/2. Here is my current version on MacOS sierra: $ 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 So if I try to pass the --http2 option to curl command, I will get the following error on screen: $ curl -I --http2 https://nixcraft.com/ curl: (1) Unsupported protocol
Fixing curl: (1) Unsupported protocol error on MacOS
Use the brew command as follows to install curl with nghttp2. nghttp2 is an implementation of HTTP/2 and its header compression algorithm HPACK in C. You need to compile and install cURL as follows: $ brew update $ brew upgrade $ brew install curl --with-nghttp2 Sample outputs:
Please note down the path “/usr/local/Cellar/curl/7.50.3/bin/curl”
Create a shortlink in your ~/bin/
Type the following command: $ mkdir $HOME/bin/ $ cd ~/bin/ $ ln -s /usr/local/Cellar/curl/7.50.3/bin/curl $ ~/bin/curl --version Sample outputs:
The author is the creator of nixCraft and a seasoned sysadmin, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly email newsletter.