Download Youtube videos on Linux & Macos

You can download easily with a command-line program called youtube-dl.
Link to site

For Macos goto:
Link to site



sudo curl -L -o /usr/local/bin/youtube-dl
sudo chmod a+rx /usr/local/bin/youtube-dl


sudo wget -O /usr/local/bin/yt-dlp
sudo chmod a+rx /usr/local/bin/yt-dlp

Upgrade (always use the latest version!)


sudo -H pip install --upgrade youtube-dl


sudo yt-dlp -U

Download a single movie in mp4 format and best quality

Tip: create a video folder and open the terminal from this folder to execute the statements.


youtube-dl -f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/bestvideo+bestaudio' --merge-output-format mp4 <video-url>


yt-dlp -f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/bestvideo+bestaudio' --merge-output-format mp4 <video-url>

Everywhere below where you see youtube-dl as command, use yt-dlp when on Macos

Download all videos in a playlist at once

youtube-dl -f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/bestvideo+bestaudio' --merge-output-format mp4 --output "%(title)s.%(ext)s" --yes-playlist <url-playlist>

De url-playlist is only the playlist code! Like in:

and then only:


Download a batch of movies in mp4 format and best quality

First create a file named something like videos.batch and place on every line a video that you would like to download, like:

Now you can download everything at once with the following command:

youtube-dl -a videos.batch -f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/bestvideo+bestaudio' --merge-output-format mp4

Download just music in the best possible quality

youtube-dl -f bestaudio --extract-audio --audio-format mp3 --audio-quality 0 <Video-URL>
Last update: Mon, 15 May 2023 13:30:37