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:
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:
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:
If Curl is installed and working correctly, you will see something like this:
How to install Curl on Windows?
- Download the Windows installer package from the Curl download page (64bit is recommended).
- Unpack the Curl .zip archive and place it in the desired location on the disk, for example, C:\Curl.
- 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.
- 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.
- 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:
If Curl is installed and working correctly, you will see something like this:
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:
How to check the Curl version on macOS?
To check the Curl version on macOS, open Terminal and enter the following command:
You will see something like this:
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.