How To Install and Use cURL

What is cURL?

curl is a tool to transfer data from or to a server, using one of the supported protocols (DICT, FILE, FTP, FTPS, GOPHER, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMB, SMBS, SMTP, SMTPS, TELNET and TFTP). The command is designed to work without user interaction.

You can use curl via the command lines or scripts to transfer data.

In fact, it is ubiquitous that it is also used in cars, television sets, routers, printers, audio equipment, mobile phones, tablets, settop boxes, media players and is the internet transfer backbone for thousands of software applications affecting billions of humans daily.

Check if you have Curl Installed in your System using the command.

curl --version


which curl

Since cURL is installed by default on mac OS, you will see an output like this if you are on Mac:

curl 7.54.0 (x86_64-apple-darwin18.0) libcurl/7.54.0 LibreSSL/2.6.4 zlib/1.2.11 nghttp2/1.24.1
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 HTTP2 UnixSockets HTTPS-proxy

You can also install on Mac using Homebrew:

You can do that by visiting or running:

/usr/bin/ruby -e "$(curl -fsSL"


brew install curl

Installing CURL on a Linux machine:


sudo apt-get update
sudo apt-get install curl
sudo systemctl restart apache2

If you need cURL for PHP:

First check your PHP version:

php --version


sudo apt-get install php-curl
sudo systemctl restart apache2

Verify cURL:

sudo dpkg -l curl

You can also visit cURL’s website and download the latest curl version by copying the link and using wget command


Unpack the tarball file:

tax -xvf curl-7.57.0.tar.gz

Move to the folder:

 cd curl-7.63.0

Install the C compiler:

apt-get install build-essential

Compile the source code:

make install


sudo yum update
sudo yum install curl
sudo yum install php-curl


 sudo dnf -y install php-curl

Arch Linux:


sudo pacman -Sy


 sudo pacman -S curl


sudo pacman -Qi curl

Alpine Linux:

add cURL:

apk add curl


sudo apk search curl

For Windows, you will need to download and install cURL by creating a new folder called curl in your C: drive.


Then visit and download one of the following zip files:

If you have a Windows 64 system, scroll to the Win64 – Generic section and look for the latest Win64 ia64 zip version with SSL support. It’s normally second in the list. Click the version number to start the download.

If you have a Windows 32 system, scroll to the Win32 – Generic section and look for the latest Win32 zip version with SSL support. It’s normally second in the list.

Click the version number to start the download.

Unzip the downloaded file and move the curl.exe file to your C:\curl folder.

Go to and download the digital certificate file named cacert.pem.

The PEM file contains a bundle of valid digital certificates.

The certificates are used to verify the authenticity of secure websites.

They’re distributed by certificate authority (CA) companies such as GlobalSign and VeriSign.

The PEM file allows cURL to connect securely to an API using the Secure Sockets Layer (SSL) protocol.

Move the cacert.pem file to your C:\curl folder and rename it curl-ca-bundle.crt.

Add the curl folder path to your Windows PATH environment variable so that the curl command is available from any location at the command prompt. Update the variable as follows:

In the Start menu, right-click This PC and select More > Properties.

Please note that In Windows 7, you should right-click Computer and select Properties.

Click Advanced System Settings.

In the Advanced tab, click the Environment Variables button on the lower right side.

Select the “Path” variable in System Variables, and click Edit.

In the Edit environment variable dialog box, click New and add the path to the curl.exe file. Example: C:\curl.

Windows 7: In the Variable Value textbox, append a semicolon to the value, followed by the path to the curl.exe file. Example: ;C:\curl

Keep clicking OK to accept the change and close the dialog box.

Using cURL in Windows:

You can use the Windows command prompt to run the cURL examples. To start the command prompt, open the Start menu, type cmd in the search box, and press Enter.

Using cURL:

Checking headers:

curl -I

Or download a file from a server using curl itself:

$ curl -O$file.tar.gz # Save as $file.tar.gz
$ curl -o newfile.tar.gz$file.tar.gz # Save as $newfile.tar.gz

You can resume a broken download with the curl command as follows:

curl -L -O -C -

Download multiple files info.html and about.html even from different sources in one go:

$ curl -O -O

You can combine curl with xargs ( to download files from a list of URLs in a file:

$ xargs -n 1 curl -O < listurls.txt

You can still do all these even when running behind a proxy listening on port 8080 at

$ curl -x -U user:password -O$file.tar.gz

Upload a local file named $localfile.tar.gz to sftp://ftpserver using cURL:

$ curl -u username:password -T $localfile.tar.gz sftp://ftpserver
$ curl -u username:password -T $localfile.tar.gz scp://ftpserver

For a more in-depth guide on how to use curl, a free book called Everything curl that is available in several formats is a great place to start. The HTML version can be found at

You can also see cURL’s documentation at

Or simply the best two things:

$ man curl
$ info curl