How to Install cURL on Ubuntu

Install cURL on Ubuntu with sudo apt install curl, verify with curl --version, fix curl not found and libcurl4t64 dependency errors, and prefer the native apt package over the community Snap for scripts and hidden paths.

Published

Updated

Read time 6 min read

Reviewed byDeepak Prasad

Install cURL on Ubuntu banner with terminal URL transfer icon and Ubuntu orange accent

cURL (Client URL) is the standard command-line tool for transferring data over HTTP, HTTPS, FTP, SFTP, and dozens of other protocols. Ubuntu ships curl in the main repository together with libcurl—the shared library behind the CLI and language bindings. Most tutorials, CI scripts, and installers (curl https://… | sh) assume the native apt package at /usr/bin/curl, not a sandboxed Snap build.

This guide shows how to install cURL on Ubuntu, verify the install, run a quick HTTPS test, fix common curl: command not found and libcurl4t64 dependency errors, and when a source build is worth the effort. Commands below were checked on Ubuntu 25.04.

Tested on: Ubuntu 25.04 (Plucky Puffin); kernel 6.14.0-37-generic; amd64.

NOTE
Use sudo apt install curl on Ubuntu desktops and servers. The community curl Snap is optional and has sandbox limits (hidden paths under $HOME, some pipe-to-shell installers)—see favoring the native package.

Quick command summary

Task Command
Check if curl exists command -v curl
Inspect apt candidate apt-cache policy curl libcurl4t64
Install (recommended) sudo apt update && sudo apt install -y curl
Verify version curl --version
Quick HTTPS test curl -sI https://example.com
Download to file curl -fsSLo page.html https://example.com
Remove package sudo apt purge -y curl

Prerequisites

  • Ubuntu 22.04 LTS, 24.04 LTS, or newer (25.04 tested here) on amd64 for the package names below.
  • sudo for system package installation.
  • Working apt repositories (main at minimum). Cloud images with disabled mirrors need sudo apt update before install.
  • Outbound network access for curl HTTPS tests (proxies may require https_proxy).

What you are installing

Package Role
curl CLI binary—curl, curl-config
libcurl4t64 Shared library on Ubuntu 24.04+ (replaces transitional libcurl4 naming)
libcurl4 Library package name on Ubuntu 22.04 and older

sudo apt install curl pulls the matching libcurl runtime automatically. You do not need a separate libcurl3 or libcurl3-dev step on current Ubuntu—the Ask Ubuntu era of libcurl3 is long obsolete.


Refresh indexes and check the candidate version before installing:

bash
sudo apt update
apt-cache policy curl libcurl4t64

Example on Ubuntu 25.04:

text
curl:
 Installed: 8.12.1-3ubuntu1
 Candidate: 8.12.1-3ubuntu1
 Version table:
 *** 8.12.1-3ubuntu1 500
 500 http://archive.ubuntu.com/ubuntu plucky/main amd64 Packages
libcurl4t64:
 Installed: 8.12.1-3ubuntu1
 Candidate: 8.12.1-3ubuntu1

Install with apt:

bash
sudo apt install -y curl

Use the full command sudo apt install curl. Omitting install (sudo apt curl) produces E: Invalid operation curl—a common mistake from older tutorials (Ask Ubuntu).

sudo asks for your password because installing system packages requires administrator privileges; it is not specific to curl.

Verify:

bash
curl --version
which curl
dpkg -l curl libcurl4t64
text
curl 8.12.1 (x86_64-pc-linux-gnu) libcurl/8.12.1 OpenSSL/3.4.1 zlib/1.3.1 brotli/1.1.0 zstd/1.5.6 ...
Release-Date: 2025-02-13, security patched: 8.12.1-3ubuntu1
Protocols: dict file ftp ftps gopher gophers http https imap imaps ipfs ipns ldap ldaps mqtt pop3 pop3s rtmp rtsp scp sftp smb smbs smtp smtps telnet tftp ws wss
/usr/bin/curl
ii curl 8.12.1-3ubuntu1 amd64 command line tool for transferring data with URL syntax
ii libcurl4t64:amd64 8.12.1-3ubuntu1 amd64 easy-to-use client-side URL transfer library (OpenSSL flavour)

That matches the standard apt workflow: update, install, curl --version, then fetch a URL.


Step 2: Verify with a live HTTPS request

Confirm TLS and DNS work outside apt:

bash
curl -sI https://example.com | head -5
text
HTTP/2 200
date: Thu, 25 Jun 2026 16:11:34 GMT
content-type: text/html

Download HTML to a file:

bash
curl -fsSLo /tmp/example.html https://example.com
wc -c /tmp/example.html

For day-to-day usage patterns (headers, POST, auth), see the on-site curl command cheat sheet.


Snapcraft publishes a community curl snap (publisher Yuzukosho, experimental HTTP/3). Install only when you explicitly want that build:

bash
sudo snap install curl

The Snap is sandboxed: it may not access hidden files or directories under $HOME (except .curlrc), which breaks installers that read ~/.some-config or pipe scripts from dot-directories (curl-snap issue discussion). For Whonix, cloud-init, and curl | bash bootstrap flows, stay on apt install curl.

Check which binary your shell resolves when both exist:

bash
type -a curl

Prefer /usr/bin/curl from apt for automation.


Step 4: Build cURL from source (advanced)

Compile from upstream only when you need a specific unreleased feature or custom TLS backend. Official instructions live at curl.se/docs/install.html.

Install build dependencies (install OpenSSL on Ubuntu covers libssl-dev):

bash
sudo apt update
sudo apt install -y build-essential libssl-dev zlib1g-dev

Download a current release (example 8.14.1—pick the version you need from curl.se/download):

bash
cd /tmp
wget https://curl.se/download/curl-8.14.1.tar.bz2
tar -xjf curl-8.14.1.tar.bz2
cd curl-8.14.1
./configure --prefix=/usr/local --with-openssl
make -j"$(nproc)"
sudo make install
sudo ldconfig

Confirm the new binary (may shadow apt if /usr/local/bin precedes /usr/bin on PATH):

bash
/usr/local/bin/curl --version

Remove or rename /usr/local/bin/curl when you want to return to the distribution package.


Uninstall

APT:

bash
sudo apt purge -y curl
sudo apt autoremove -y

Snap:

bash
sudo snap remove curl

Manual /usr/local build:

bash
sudo rm -f /usr/local/bin/curl /usr/local/bin/curl-config
sudo ldconfig

Troubleshooting

Symptom Likely cause Fix
curl: command not found Package not installed on minimal image sudo apt update && sudo apt install -y curl
E: Invalid operation curl Missing install subcommand Use sudo apt install curl, not sudo apt curl
Package 'curl' has no installation candidate Stale apt indexes or broken sources.list sudo apt update; verify main mirror lines; fix typo mirrors (Ask Ubuntu #259681)
curl : Depends: libcurl4t64 (= X) but Y is to be installed curl / libcurl4t64 version skew apt-cache policy curl libcurl4t64; sudo apt full-upgrade or sudo apt install --reinstall libcurl4t64=<matching version> (Ask Ubuntu #1526810)
Snap curl warns about sandbox / hidden folders Community Snap confinement sudo apt install curl; use /usr/bin/curl
curl: (6) Could not resolve host DNS failure or typo in URL Fix hostname; check /etc/resolv.conf and VPN
Wrong curl version after manual install /usr/local/bin before /usr/bin which curl; remove custom build or adjust PATH
wget works but tutorial requires curl Different tools Install curl—wget is not a drop-in for all curl flags

References


Summary

The reliable way to install cURL on Ubuntu is sudo apt update && sudo apt install -y curl. That places /usr/bin/curl on your path and installs the matching libcurl4t64 (or libcurl4 on 22.04) library. Confirm with curl --version and a quick curl -sI https://example.com.

Skip the community Snap for bootstrap scripts and tools that read hidden home-directory paths—apt curl is what Ubuntu documentation and security-focused workflows expect. Build from curl.se source only when apt’s security-patched build lacks a feature you truly need.

Frequently Asked Questions

1. How do I install cURL on Ubuntu?

Run sudo apt update && sudo apt install -y curl. The curl package depends on libcurl4t64 (on Ubuntu 24.04 and newer) or libcurl4 on older releases. Verify with curl --version and which curl (typically /usr/bin/curl).

2. Why does Ubuntu say curl is not installed?

Minimal cloud images and some containers ship without curl. Install it with sudo apt install curl—not sudo apt curl (install is required). If apt reports no installation candidate, run sudo apt update and check that main/universe repositories are enabled in /etc/apt/sources.list.

3. Is cURL installed by default on Ubuntu?

Not always. Server and container images often omit it. Desktop installs may include curl as a dependency of other packages. Run command -v curl; if empty, install from apt.

4. What is the difference between curl and libcurl on Ubuntu?

curl is the command-line client at /usr/bin/curl. libcurl4t64 (or libcurl4) is the shared library curl links against. apt install curl pulls in the matching libcurl package automatically—you do not install libcurl separately for normal CLI use.

5. Should I install cURL from Snap on Ubuntu?

Prefer sudo apt install curl. The community curl Snap (Yuzukosho) is sandboxed and cannot read hidden files under $HOME except .curlrc, which breaks some install scripts. Use apt for Whonix installers, pipe-to-sh bootstrap scripts, and automation.

6. How do I fix libcurl4t64 dependency errors when installing curl?

On Ubuntu 24.04 this usually means curl and libcurl4t64 versions are out of sync—often after a partial upgrade. Run apt-cache policy curl libcurl4t64, then sudo apt install --reinstall libcurl4t64= or sudo apt full-upgrade to align both packages from the same mirror.

7. How do I install a newer cURL than Ubuntu apt provides?

For most users the Ubuntu security-patched build is enough. When you need upstream features, compile from curl.se/download or use a third-party PPA only if you understand the trade-offs. Remove or shadow the apt curl before installing a custom /usr/local build.

8. How do I uninstall cURL from Ubuntu?

Run sudo apt purge -y curl. libcurl4t64 may remain if other packages depend on it—check with apt-cache rdepends libcurl4t64 before purging the library. For Snap: sudo snap remove curl.

9. What is the correct apt command—apt-get install curl or apt install curl?

Both work. Modern Ubuntu uses apt install curl (same packages). Always include install—sudo apt curl alone is invalid and prints E: Invalid operation curl.
Deepak Prasad

R&D Engineer

Founder of GoLinuxCloud with more than 15 years of expertise in Linux, Python, Go, Laravel, DevOps, Kubernetes, Git, Shell scripting, OpenShift, AWS, Networking, and Security. With extensive …