Install Curl

Curl ships with macOS and with Windows 10 and 11, and it is one package away on every Linux distribution. The cases that take longer are the ones this page spends its time on: minimal Docker images, a second copy shadowing the first, and a version too old for the flag you need.

Last updated . How this page is checked.

The command

sudo apt update && sudo apt install -y curl

The install command for each system

CommandSystem
sudo apt install curlUbuntu, Debian, Linux Mint, Raspberry Pi OS
sudo dnf install curlFedora, RHEL, Rocky Linux, AlmaLinux
sudo pacman -S curlArch Linux, Manjaro
sudo zypper install curlopenSUSE
apk add curlAlpine Linux
brew install curlmacOS, for a newer build than the one Apple ships
winget install cURL.cURLWindows, for a newer build than the one in System32

Check what you already have

Before installing anything, ask the shell where curl is and what it reports. command -v prints the path of the copy that will run. The version output has three parts worth reading: the release number on the first line, the TLS library named next to it, and the Features line, where HTTP2, HTTP3 and brotli appear only if this particular build includes them. Two machines with the same curl version can differ in features, because each distribution compiles its own.

command -v curl
curl --version

Linux: use the package manager

Every distribution packages curl, and the packaged build is the one to use: it receives security fixes with the rest of the system and is linked against the system's certificate store. Refresh the package index first on Debian-family systems, or apt may try to download a version that has since been replaced.

Red Hat family images often come with curl-minimal, a cut-down build that handles HTTP and HTTPS and leaves out the less common protocols. Asking for the full package on top of it reports a conflict; the --allowerasing option lets dnf swap one for the other. On Ubuntu, prefer apt to the snap package of the same name. The snap is sandboxed and cannot read or write files outside your home directory, which breaks -o and -d @file for paths elsewhere.

# Debian, Ubuntu
sudo apt update && sudo apt install -y curl

# Fedora, RHEL, Rocky, Alma
sudo dnf install -y curl
sudo dnf install -y curl --allowerasing     # replace curl-minimal with the full build

# Alpine
apk add curl

Docker images and CI runners

Slim base images leave curl out to save space, which is why a health check or a build step fails with curl: command not found in a container and works on your laptop. Install it in the image, in the same layer as the index update, and remove the package lists afterwards so they do not stay in the layer.

Install ca-certificates alongside it. Without that package there is no list of trusted authorities, and every HTTPS request fails with exit code 60 or 77 even though curl itself is working. Alpine images already carry a certificate bundle; on Debian the certificates are only a recommended package, so they are skipped when recommendations are switched off.

# Debian or Ubuntu based image
RUN apt-get update \
 && apt-get install -y --no-install-recommends curl ca-certificates \
 && rm -rf /var/lib/apt/lists/*

# Alpine based image
RUN apk add --no-cache curl

macOS

Apple includes curl at /usr/bin/curl and updates it with the operating system, so there is nothing to install for everyday use. It is Apple's own build and can lag behind the current release. Homebrew provides a newer one, but as a keg-only formula: it is installed without being linked into your path, precisely so that it does not replace the system copy. To use it by default, put its directory ahead of /usr/bin.

brew install curl
echo 'export PATH="$(brew --prefix curl)/bin:$PATH"' >> ~/.zshrc
exec zsh
command -v curl      # now the Homebrew path

Windows

Windows 10 from version 1803, and every Windows 11, has curl.exe in C:\Windows\System32. It is a Microsoft build that uses the Windows certificate store, and it is updated through Windows Update, not by you. For a current release with more features, install the curl project's build with winget or download it from the project's Windows page; it comes with its own certificate bundle. Then check which copy answers first.

where.exe curl
curl.exe --version
winget install cURL.cURL

Is your version new enough?

An unknown-option error usually means the installed curl predates the flag. A few that documentation now uses freely: --json needs 7.82.0, --fail-with-body needs 7.76.0, --retry-all-errors needs 7.71.0, and the %{json} write-out variable needs 7.70.0. Long-term-support distributions keep the curl version they launched with and backport only security fixes, so a server can be several years behind your laptop. When a command works locally and fails in production, compare the two version numbers before anything else.

Common mistakes

  • Installing curl at container start instead of in the image. It slows every start and fails when the registry mirror is unreachable. Put it in the Dockerfile.
  • Two copies on the path. Homebrew on macOS, and Git Bash or Cygwin on Windows, bring their own curl. which -a curl, or where.exe curl, lists every copy in the order the shell will try them.
  • Assuming a feature from the version number. HTTP/3, Brotli and some protocols are compile-time choices. The Features and Protocols lines of curl --version are the only reliable answer.
  • Piping an installer from curl straight into a shell as root. If you must, download the script to a file, read it, then run it.

Related curl examples

More under Reference

References

These links leave api-tester.com, which is independent of the projects they point to.

FAQ

How do I install curl on Ubuntu?

Run sudo apt update, then sudo apt install curl. The same two commands work on Debian and other distributions that use apt.

How do I check which version of curl is installed?

Run curl --version. The first line shows the version number and the TLS library, and the lines below list the protocols and features that build supports.

Is curl installed by default on Windows?

Yes. Windows 10 version 1803 and later, and all versions of Windows 11, include curl.exe in the System32 folder. In Windows PowerShell 5.1 type curl.exe, because curl on its own is an alias for a different command.

How do I fix curl: command not found?

Curl is not installed, or not on the path. Install it with the package manager for your system: apt on Debian and Ubuntu, dnf on Fedora and RHEL, apk on Alpine. In a Docker image, add the install command to the Dockerfile.

Does macOS come with curl?

Yes. Apple ships curl at /usr/bin/curl and updates it with the operating system. A newer version can be installed with Homebrew, which keeps it separate from the system copy unless you add it to your path.