Skip to content

Start typing. Errors match on their exact yt-dlp output.

to move, to open esc to close

Install yt-dlp on Ubuntu 24.04 and Debian

Tested on yt-dlp 2026.07.28 Updated

Quick answer

apt install yt-dlp gives you a build frozen at the LTS release date, which cannot download from YouTube any more. Two routes work: pipx if you want it managed, the standalone binary if you want it current. Install ffmpeg from apt either way:

pipx — managed, no root for yt-dlp itself
sudo apt update && sudo apt install -y pipx ffmpeg
pipx ensurepath
pipx install yt-dlp

Then open a new terminal — pipx ensurepath edits your shell profile and the current session will not see it.

Why not apt

Ubuntu freezes package versions at release and ships only security fixes for the rest of the cycle. For a library that is correct. For yt-dlp, whose entire purpose is to keep up with sites that change every few weeks, it means the packaged build is obsolete within months and thoroughly broken within a year.

What that looks like in practice is not an "out of date" message. It is nsig extraction failed, unable to extract player response, and downloads capped at 360p — hours of debugging for a problem whose cause is a release policy.

Check what you have:

bash
yt-dlp --version
apt list --installed 2>/dev/null | grep yt-dlp

The version is a date. If it is more than a couple of months old, that is your problem.

The externally-managed-environment error

The obvious next move is pip install yt-dlp, and on 23.04 and later it refuses:

what you get
error: externally-managed-environment

× This environment is externally managed
╰─> To install Python packages system-wide, try apt install
    python3-xyz, where xyz is the package you are trying to
    install.

This is PEP 668, and it is protecting you. apt-installed Python packages are dependencies of system tools, and pip overwriting one has historically broken things as central as the package manager itself.

Route 1 — pipx

An isolated virtual environment per tool, managed for you. Nothing touches system Python:

bash
sudo apt install -y pipx
pipx ensurepath
pipx install yt-dlp
pipx upgrade yt-dlp

On 22.04 and older, pipx is not packaged — python3 -m pip install --user pipx works there, or take route 2.

Route 2 — the standalone binary

One file, Python bundled inside, updates itself with -U. The fastest route to extractor fixes:

bash
sudo curl -L https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp -o /usr/local/bin/yt-dlp
sudo chmod a+rx /usr/local/bin/yt-dlp
yt-dlp --version

Remove the apt version first, or you will have two and PATH order decides which runs:

bash
sudo apt remove yt-dlp
which -a yt-dlp

ffmpeg

apt's ffmpeg is fine — it is not chasing a moving target. On minimal or server images, the extra codec package is worth adding at the same time, or audio extraction fails later:

bash
sudo apt install -y ffmpeg libavcodec-extra

Keeping it current

pipx
pipx upgrade yt-dlp
binary
sudo yt-dlp -U
sudo yt-dlp --update-to nightly

If updating as root is unwelcome, install to ~/.local/bin instead so your own user owns the file. The comparison page covers the trade-off between stable and nightly.

Server and headless notes

On a server there is no browser and no desktop keyring, so --cookies-from-browser cannot work. Export a cookies.txt on your desktop, copy it across, and lock it down:

bash
scp cookies.txt user@server:~/cookies.txt
ssh user@server 'chmod 600 ~/cookies.txt'

Also expect stricter treatment from YouTube: datacentre address ranges attract rate limits and bot checks far sooner than a home connection. Pace anything scheduled.

A cron job that does not surprise you

crontab -e
0 3 * * * /usr/local/bin/yt-dlp --download-archive /srv/media/archive.txt \
  --sleep-requests 2 --limit-rate 2M -i \
  -o "/srv/media/%(uploader)s/%(title)s.%(ext)s" \
  "CHANNEL_URL" >> /var/log/ytdlp.log 2>&1

Absolute paths because cron has almost no environment; an archive file so a rerun is a continuation; a log because a silent failure at 3am is a failure you find out about in a month.

If it still fails

  • pipx installed it and the shell cannot find it. pipx ensurepath edited your profile; open a new terminal.
  • Version did not change after updating. Two installs. which -a yt-dlp.
  • Everything caps at 360p. ffmpeg missing — the 360p page.
  • Works in WSL, not in Windows. Two separate installs on two separate filesystems. See the Windows page.

Frequently asked

What is the externally-managed-environment error?
PEP 668. The distribution marks its system Python as managed by apt, and pip refuses to write into it — because doing so has historically broken system tools that depend on those packages. It is a guard rail, not a bug, and --break-system-packages is exactly as bad an idea as its name suggests.
Is there an official PPA?
No. Several third-party PPAs exist and their update cadence varies from good to abandoned. The standalone binary updates itself and needs no trust in a stranger's build.
How far behind is apt's version really?
On Ubuntu 24.04 the packaged build is from before release and gets only security updates, so it ages a full LTS cycle. On a tool that needs monthly extractor fixes, that is not a small gap — it is the difference between working and not.
Does the snap work?
It runs, but the sandbox complicates reading browser cookies and writing outside your home directory. For a tool this small, the binary avoids the whole category.