How to download youtube videos using open source software

Nikhil Vijayan
1 min readOct 5, 2022


If you’ve tried to download youtube videos while trying not to download malware, this is for you.


You will need to have Docker installed, and know if your terminal uses bash or zsh.

All you have to do is use this incantation

alias yt-dl='docker run \
--rm -i \
-e PGID=$(id -g) \
-e PUID=$(id -u) \
-v "$(pwd)":/workdir:rw \

Add 👆this to your ~/.bash_aliases file or ~/.bashrc or ~/.zshrc file.

Once you’ve done that (and used source ~/.zshrc , or whatever the name of your rc file you updated) you can download videos by using yt-dl <youtube-url>

Further reading:

Disclaimer: this might work for apple and linux devices only. Post a comment if you need help.

Also, we’re using docker here so we don’t run into any problems in terms of yt-download not being compatible with your machine (this is what happened with me).

Example usage:

yt-dl --extract-audio --audio-format mp3



Nikhil Vijayan