Installing curl
About curl
curl is a command-line utility that lets you execute HTTP requests with different parameters and methods. curl (or cURL) stands for Client URL.
curl is usually available by default on macOS, and is available on Linux via standard package managers. It is also available for download and installation on Windows. Follow the instructions below to check for and (if needed) install curl.
Installing curl (Linux)
- Open a terminal window and enter the command below to install
- For Ubuntu type
sudo apt install curl
- For CentOS type
sudo yum install curl
- For Ubuntu type
- If prompted, enter your password
- Once installed, type
curl -V
. The response should look something like the example below:
curl 7.68.0 (x86_64-pc-linux-gnu) libcurl/7.68.0 OpenSSL/1.1.1f zlib/1.2.11 brotli/1.0.7 libidn2/2.2.0 libpsl/0.21.0 (+libidn2/2.2.0) libssh/0.9.3/openssl/zlib nghttp2/1.40.0 librtmp/2.3
Release-Date: 2020-01-08
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp scp sftp smb smbs smtp smtps telnet tftp
Features: AsynchDNS brotli GSS-API HTTP2 HTTPS-proxy IDN IPv6 Kerberos Largefile libz NTLM NTLM_WB PSL SPNEGO SSL TLS-SRP UnixSockets
Installing curl (macOS)
By default, curl should already be installed on macOS. To check, do the following:
- Open the
Terminal
command prompt (There are several ways to get to Terminal. Here, we're using Spotlight):- Select Cmd + spacebar to launch Stoplight.
- Type
Terminal
into the search box, then double-clickTerminal
from the search results. The Terminal application launches to the command prompt.
- Type
curl -V
. The response should look something like the example below:
curl 7.54.0 (x86_64-apple-darwin16.0) libcurl/7.54.0 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
If you don't get this response, you need to download and install curl.
Installing curl (Windows)
To see if curl is already installed, do the following:
- Open a
Command
prompt. (Right-click the Start button, selectRun
(orSearch
), and typecmd
.) - Type
curl -V
. The response should look something like the example below:
curl 7.79.1 (Windows) libcurl/7.79.1 Schannel
Release-Date: 2021-09-22
Protocols: dict file ftp ftps http https imap imaps pop3 pop3s smtp smtps telnet tftp
Features: AsynchDNS HSTS IPv6 Kerberos Largefile NTLM SPNEGO SSL SSPI UnixSockets
If you don't get this response, you need to download and install curl.
Before installing curl on Windows, you'll need to determine whether you have 32-bit or 64-bit Windows. To do this, right-click the Start button and select
System
.
Formatting curl for Windows
If you are using curl with a Windows OS, be aware of the following formatting requirements:
- Change single quotes to double quotes in the command line. (Windows does not support single-quotes.)
- Remove the backslashes (). (These are used to separate lines for readability purposes.)
See the working examples below.
curl --request GET \
--url http://hapi.fhir.org/baseR4/AllergyIntolerance \
--header 'Accept: */*'
curl --request GET "http://hapi.fhir.org/baseR4/AllergyIntolerance" --header "Accept: */*"
Updated over 2 years ago