youtube-dl is a small Python-based script for downloading YouTube videos. It is used from the command line, and there are several ways to install it.

Installation

The official installation method places the script in /usr/local/bin and marks it executable. Use either curl or wget:

sudo curl https://yt-dl.org/latest/youtube-dl -o /usr/local/bin/youtube-dl
sudo chmod a+x /usr/local/bin/youtube-dl

Or:

sudo wget https://yt-dl.org/downloads/latest/youtube-dl -O /usr/local/bin/youtube-dl
sudo chmod a+x /usr/local/bin/youtube-dl

Alternatively, you can install it through pip or Homebrew:

sudo pip install youtube-dl
brew install youtube-dl

Basic usage

Once it is installed, the basic command form is:

youtube-dl [OPTIONS] URL [URL...]

You can provide one or more URLs, along with any options you need. The project page is at https://github.com/rg3/youtube-dl/.