DEV Community

VMHEAVEN
VMHEAVEN

Posted on Originally published at vmheaven.io

curl: command not found? Fix it on any Linux distro (and Windows)

First published on the VMHeaven blog: curl: command not found? How to fix it on any Linux distribution. The canonical points there, and the full guide covers every distro, Docker, PATH issues and Windows.

Short answer: curl: command not found almost always means curl is not installed. Minimal Linux images leave it out, and the Debian installer ships wget instead of curl, so the fix is usually one package. Only when curl is installed and the shell still cannot find it do you have a PATH problem.

Install it

Debian / Ubuntu

sudo apt update
sudo apt install -y curl
Enter fullscreen mode Exit fullscreen mode

Alpine (what most slim Docker images are built on):

apk add curl
Enter fullscreen mode Exit fullscreen mode

Rocky / AlmaLinux / RHEL / Fedora

sudo dnf install -y curl
Enter fullscreen mode Exit fullscreen mode

Arch: sudo pacman -S --noconfirm curl - openSUSE: sudo zypper install -y curl

In a Docker container

You are usually already root (so no sudo) and the package index is empty. Install it in the Dockerfile, not by hand:

RUN apt-get update \
 && apt-get install -y --no-install-recommends curl ca-certificates \
 && rm -rf /var/lib/apt/lists/*
Enter fullscreen mode Exit fullscreen mode

Add ca-certificates too, or every HTTPS request fails with curl: (77).

Installed but still "not found"?

Then it is a PATH problem, not a missing package:

  • The shell cached an old location -> run hash -r (bash) or rehash (zsh), or open a new shell.
  • A startup file overwrote PATH (if ls/grep are also missing) -> restore PATH for the session, then fix the line in ~/.bashrc / ~/.zshrc.
  • sudo: curl: command not found while plain curl works -> sudo uses secure_path, not your PATH. Install the distro package (it lands in /usr/bin), or pass the full path: sudo "$(command -v curl)" ....

Full guide

Distroless images, OpenWrt, the Windows curl.exe vs the PowerShell curl alias, and every distro are covered in the complete version:

curl: command not found - the complete fix

Need a clean box to try this on? A Debian or Ubuntu VPS spins up in a minute.

Top comments (0)