Installing Curl on Linux, Windows, and macOS

What is Curl?

A curl is a command-line tool widely used by developers, administrators, and DevOps in their automation scripts and API testing for pushing data to and from the server. Curl allows you to send data from the command line to the server, as well as download and save data to disk. Curl supports all popular protocols, including HTTP, HTTPS, FTP, and SFTP, has built-in proxy support, certificate validation, rate limits, and works on almost every platform.
ReqBin has prepared a quick guide for installing Curl command-line tool on Linux, Windows, and macOS platforms.

How to install Curl on Linux?

You can easily install Curl on Ubuntu/Debian Linux using the apt or apt-get commands. To install Curl on your system, enter the following command in the terminal:

Install Curl on Ubuntu/Debian Linux
sudo apt install curl
or
sudo apt-get install curl

Since we are using sudo, a password may be required after running apt-get install curl. Enter your password and wait for the installation to complete.

To install Curl on RHEL, CentOS and Fedora, run the following command in a terminal:

Install Curl on RHEL, CentOS and Fedora Linux
yum install curl

That's it, now you have Curl installed on your Linux, and you can use it!

How to check if Curl is installed on Linux?

You can check that Curl is installed and working correctly on Linux by running the following command in a terminal:

Check Curl installation
curl --version

If Curl is installed and working correctly, you will see something like this:

user@workstation:~$ curl --version
curl 7.58.0 (x86_64-pc-linux-gnu) libcurl/7.58.0 OpenSSL/1.1.1 zlib/1.2.11 libidn2/2.0.4 libpsl/0.19.1 (+libidn2/2.0.4) nghttp2/1.30.0 librtmp/2.3
Release-Date: 2018-01-24
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp smb smbs smtp smtps telnet tftp
Features: AsynchDNS IDN IPv6 Largefile GSS-API Kerberos SPNEGO NTLM NTLM_WB SSL libz TLS-SRP HTTP2 UnixSockets HTTPS-proxy PSL

How to install Curl on Windows?

  1. Download the Windows installer package from the Curl download page (64bit is recommended).
  2. Unpack the Curl .zip archive and place it in the desired location on the disk, for example, C:\Curl.
  3. Add the Curl binary folder (C:\Curl\bin) to your Windows PATH environment variable so you can invoke the Curl command from any other folder.
  4. Update the Curl valid digital certificate bundle file by downloading the cacert.pem file from the CA Extract page and placing it to the C:\Curl\bin folder as curl-ca-bundle.crt. The cacert.pem file contains valid CA certificates extracted from the Mozilla PEM certificate store.
  5. Make sure you can execute Curl commands by typing curl --version at the command line.

That's it, now you have Curl installed on your Windows, and you can use it!

How to check if Curl is installed on Windows?

You can check that Curl is installed and working correctly on Windows by running the following command at the command prompt:

Check Curl installation
curl --version

If Curl is installed and working correctly, you will see something like this:

C:\>curl --version
curl 7.55.1 (Windows) libcurl/7.55.1 WinSSL
Release-Date: 2017-11-14, security patched: 2019-11-05
Protocols: dict file ftp ftps http https imap imaps pop3 pop3s smtp smtps telnet tftp
Features: AsynchDNS IPv6 Largefile SSPI Kerberos SPNEGO NTLM SSL

How to install Curl on macOS?

Curl comes bundled with macOS, but if you want to update Curl to the latest version, you can use the macOS Homebrew software package manager. If you do not have a Homebrew package manager, download and install it first. If you already have the Homebrew package manager installed on macOS, open a terminal and type:

Install Curl on macOS
brew install curl

How to check the Curl version on macOS?

To check the Curl version on macOS, open Terminal and enter the following command:

Check Curl version
curl --version

You will see something like this:

user:~ macuser$ curl --version
curl 7.31.0 (x86_64-apple-darwin12.4.0) libcurl/7.31.0 OpenSSL/0.9.8x zlib/1.2.5
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp smtp smtps telnet tftp 
Features: IPv6 Largefile NTLM NTLM_WB SSL libz 

How to enable Curl extension in PHP?

Curl is a PHP extension that allows PHP applications to send and receive data using URL syntax. To enable PHP Curl extension, open php.ini file, find extension=php_curl.dll, uncomment this line, and restart Apache server.

Conclusion

Curl is a potent yet easy-to-use command-line tool used for testing APIs and in automation scripts. Installing Curl is a simple procedure that often boils down to simply executing one command in a Terminal window. Curl has been in use for about twenty years among programmers and administrators and is becoming increasingly popular due to its simplicity, ease of installation, and open-source code.

See Also

Updated: Viewed: 10285 times