youtube-dlp (download)

Cross platform utility to download video+audio either single files or entire playlists. Supports YouTube, Vimeo etc.

      yt-dlp [OPTIONS] URL [URL...]

   -F, --list-formats         List all available formats.
   -f, --format FORMAT        Video format code, see example below.
   -i, --ignore-errors        Continue on download errors, for example to skip unavailable
                              videos in a playlist.
   --abort-on-error           Cancel downloading of further videos (in the playlist or the
                              command line) if an error occurs.
   --no-playlist              Download only the video, if the URL refers to a video and a playlist.
   --yes-playlist             Download the playlist, if the URL refers to a video and a playlist.
   -a, --batch-file FILE      File containing URLs to download ('-' for stdin.)
   --restrict-filenames       Restrict filenames to only ASCII characters, and avoid "&" and
                              spaces in filenames.
   -w, --no-overwrites        Do not overwrite files.
   --write-description        Write video description to a .description file.
   --write-info-json          Write video metadata to a .info.json file.
   --write-annotations        Write video annotations to a .annotations.xml file.
   -q, --quiet                Activate quiet mode.
   --no-mtime                 Set the file last modified date/time to the download date/time.
   --no-warnings              Ignore warnings.
   --console-title            Display progress in console titlebar.
   --sleep-interval SECONDS   Number of seconds to sleep before each download.
   -h, --help                 Print this help text and exit.
   -U, --update               Update this program to latest version. Make sure that you have
                              sufficient permissions (run with sudo if needed.)
   --version                  Print program version and exit.

Above is a summary of the options, for a full list including network/proxy/filtering options, run youtube-dl --help

The files are downloaded to the current directory.


1) Download yt-dlp to /usr/local/bin/

sudo curl -L -o /usr/local/bin/yt-dlp

( If /usr/local/bin does not already exist, then create it with sudo mkdir -p /usr/local/bin )

or for the older Youtube-DL version:

sudo curl -L -o /usr/local/bin/youtube-dl

2) Apply permissions:

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

or for the older Youtube-DL:

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

3) Install ffmpeg for converting file formats:

Download ffmpeg and copy it to /usr/local/bin/

Apply permissions

sudo chmod a+rx /usr/local/bin/ffmpeg

The right-click and open ffmpeg so that macOS will recognise and allow it to be run.

4) For M1 macs/Monterey install a recent non-beta copy of Python from (around 40 MB).

The installer will put python into /usr/local/bin/
after the installer has finished run the two shell scripts which you will find under /Applications/Python 3.10/ from the terminal:
Install Certificates.command
Update Shell Profile.command


First list the available formats with -F

$ yt-dlp -F

140          m4a        audio only DASH audio  127k , m4a_dash container, aac  @128k (44100Hz), 3.77MiB
141          m4a        audio only DASH audio  255k , m4a_dash container, aac  @256k (44100Hz), 7.57MiB ***
160          mp4        256x144    DASH video  113k , 12fps, video only, 3.24MiB
133          mp4        426x240    DASH video  269k , 24fps, video only, 7.27MiB
134          mp4        640x360    DASH video  272k , 24fps, video only, 6.55MiB
244          webm       854x480    DASH video  504k , 24fps, video only, 7.95MiB
135          mp4        854x480    DASH video  540k , 24fps, video only, 13.33MiB
136          mp4        1280x720   DASH video 1155k , 24fps, video only, 26.62MiB
248          webm       1920x1080  DASH video 1797k , 24fps, video only, 30.81MiB
137          mp4        1920x1080  DASH video 2750k , 24fps, video only, 57.97MiB   ***   
43           webm       640x360    
18           mp4        640x360    
22           mp4        1280x720   (best)

Using the numeric codes in the first column, you can select a specific size of Video and Audio.
So in this example, we want 1080p video (137) plus 255K audio (141) so the command becomes:

$ yt-dlp -f 137+141

If you just want the (best) possible quality, this is the default so all you need is:

$ yt-dlp

The (best) quality may not be the largest size, e.g. if a 720p video has been transcoded to 1080p it will be larger but won't look any sharper. However the algorithm for selecting (best) is not perfect so often you will get higher quality by manually selecting the size.

By default the date/time of the downloaded file will be equal to the upload date/time to hopefully give an approximately correct date of the files creation, to disable this and return the downloaded date use the option --no-mtime


You can run youtube-dl directly from any web browser (or any other application) using macOS services and Automator.

Although this makes for an easy to use inferface, this will auto-select the video quality, often defaulting to 720p.

Choose Applications Automator and then create a new Service (click the Service icon.)
Set the drop-down lists as shown below, pass input 'as arguments'
The Shell script can just be two lines, one to cd change directory to where you want the movie saved, and the second to run youtube-dl passing the URL.

With that done save the Automator Service with a suitable name like "Save Youtube Movie"

Use Automator to run a Shell Script

To run this, select any URL, in the web browser address bar, or even just a suitable url within a text document, then go to the services menu and select the name of your Automator service "Save Youtube Movie".
Automator Services are automatically saved to ~/Library/Services/

“Make each program do one thing well.
To do a new job, build afresh rather than complicate old programs by adding new features” ~ Ken Thompson

Related commands:

rsync - Remote file copy.
Youtube-dl project page
yt-dlp - Fork with additional features.

Copyright © 1999-2024
Some rights reserved