How to download youtube video from Terminal Mac?

First thing you need to do is install the plugin called youtube-dl To install youtube-dl follow the steps below or visit link.

To install it right away for all UNIX users (Linux, OS X, etc.), type:

sudo curl https://yt-dl.org/downloads/2015.09.09/youtube-dl -o /usr/local/bin/youtube-dl
sudo chmod a+rx /usr/local/bin/youtube-dl

You can use Homebrew if you have it:
brew install youtube-dl

To download video from Terminal Mac

Once, you have that installed, all you need is to hit the command from your terminal as:

Sureshs-MacBook-Pro:~ sureshkumarmukhiya$ youtube-dl https://www.youtube.com/watch?v=eX66RMW-GP4

youtube-dl is a feature rich utility, you can also download video in another format. All you need to use is -f option of this utility. Here is what the man page of this utility has to say about -f option :

-f FMT, –format=FMT
Specify the video format (quality) in which to download the video.

For youtube.com, in particular, the meaning of the format codes is given as:

WebM video at 480p: 43
WebM video at 720p: 45
H264 video in MP4 container at 480p: 18
H264 video in MP4 container at 720p: 22
H264 video in MP4 container at 1080p: 37
H264 video in FLV container at 360p: 34
H264 video in FLV container at 480p: 35
H263 video at 240p: 5
3GP video: 17
For more options, see the man page of youtube-dl.

Download MP3

To download MP3 version of the video, you the command like:

youtube-dl –extract-audio –audio-format mp3 <video URL>

Example:

youtube-dl –extract-audio –audio-format mp3 https://www.youtube.com/watch?v=zn2CZ3MGUu0

Note this needs, ffmpeg or avconv installed.

 

Tags :

About the Author

dr.code.skm

I am backend developer with passion in Web Application development using latest technologies like Laravel, PHP7, React, ECMAScript 6 and WordPress. I prefer spending time analyzing big data with Apache Spark. Apart from that, I do photography.