News & Updates

How to Install yt-dlp on Termux: A Step‑by‑Step Guide

By Natalie Farrow 7 min read 2070 views

How to Install yt-dlp on Termux: A Step‑by‑Step Guide

Termux turns your Android phone into a lightweight Linux terminal, and yt‑dlp is the go‑to tool for grabbing videos from just about any site. Combining the two gives you a portable downloader that runs entirely offline. Below is a practical walkthrough that assumes you have already installed Termux from F‑Droid or the Play Store.

Why Choose yt‑dlp Over Other Downloaders?

  • Active development: frequent updates keep up with site changes.
  • Versatile options: you can select formats, extract audio, embed subtitles, and more.
  • Python‑based: it runs on the same interpreter that powers many other Termux packages.

Prerequisites

Before diving in, make sure you have:

  • Termux installed and updated.
  • Internet connection (you’ll need it for the initial download).
  • Basic comfort with command‑line navigation.

Update Termux and Install Core Packages

Open Termux and run the following commands. They ensure the repository list is fresh and that Python and pip are ready.

pkg update && pkg upgrade -y

pkg install python git -y

Sometimes the python package pulls in pip automatically; if not, install it explicitly:

pip install --upgrade pip setuptools

Cloning the yt‑dlp Repository

While you could install directly from PyPI, cloning the repo guarantees you get the very latest commit. Execute:

git clone https://github.com/yt-dlp/yt-dlp.git

cd yt-dlp

If you prefer a stable release, replace the git clone line with:

pip install yt-dlp

Building the Executable

Inside the cloned folder, create a standalone binary that doesn’t depend on a separate Python interpreter. This step is optional but handy for quick calls.

python -m pip install -U .[default]

python -m yt_dlp -h # sanity check

After the command finishes, you’ll see the help output, confirming the build succeeded.

Adding yt‑dlp to Your PATH

To run yt-dlp from any directory, move the executable to a location that Termux already includes in its PATH, such as $HOME/.local/bin:

mkdir -p $HOME/.local/bin

cp yt-dlp $HOME/.local/bin/

chmod +x $HOME/.local/bin/yt-dlp

If .local/bin isn’t part of PATH, add it to your .bashrc (or .zshrc if you use Zsh):

echo 'export PATH=$HOME/.local/bin:$PATH' >> $HOME/.bashrc

source $HOME/.bashrc

Testing the Installation

Run a quick test by fetching the title of a popular video:

yt-dlp -e https://www.youtube.com/watch?v=dQw4w9WgXcQ

If the title prints without errors, you’re ready to start downloading.

Common Use Cases

  • Download best‑quality video: yt-dlp -f best URL
  • Extract audio only (MP3): yt-dlp -x --audio-format mp3 URL
  • Save subtitles: yt-dlp --write-subs --sub-lang en URL
  • Batch download from a list: place URLs in list.txt and run yt-dlp -a list.txt

Handling Permissions and Storage

Termux runs in its own sandbox, so writing files to the shared Android storage requires explicit permission. Grant access with:

termux-setup-storage

After confirming, you can direct output to the shared folder, for example:

yt-dlp -o /storage/emulated/0/Download/%(title)s.%(ext)s URL

Troubleshooting Tips

  • Missing SSL libraries? Re‑install openssl-tool via pkg install openssl-tool.
  • “Permission denied” on execution? Double‑check the chmod +x step and that the binary lives in a directory listed in PATH.
  • Site‑specific errors? Run yt-dlp -U to pull the newest patches; many breakages stem from upstream changes.

Keeping yt‑dlp Up to Date

Because video sites tweak their APIs regularly, staying current matters. The simplest approach is:

pip install -U yt-dlp

If you cloned the repository, pull the latest changes and reinstall:

cd yt-dlp

git pull

python -m pip install -U .

Wrapping Up

With Termux and yt‑dlp on your device, you’ve essentially built a pocket‑sized media library manager. The steps above may feel a bit technical, but once the setup is done, downloading content becomes a matter of typing a short command. Explore the myriad options in yt-dlp --help and tailor the tool to your workflow—whether you’re archiving lectures, grabbing music, or simply keeping a favorite clip handy for offline viewing.

Tutorial Install Termux melalui GitHub (Termux Releases) - PTI Institut ...
Complete Guide: How to Download and Install Termux on Android | Step-by ...
Termux Commands Cheat Sheet 2025: The Complete Guide
Unlock Termux’s full potential: 5 essential setup steps

Written by Natalie Farrow

Natalie Farrow is a Chief Correspondent with over a decade of experience covering breaking trends, in-depth analysis, and exclusive insights.