Download Youtube Videos

I have made a macro to download primarily Youtube-videos. Even tough it works on other videosites.
Sometimes I need to take some videos to places where I do not have internet.

Videos are download into your downloads folder. Subtitles are downloaded as well.

For the macro to work you need to have the youtube-dl command line tool installed on your Mac. A comfortable way to install the latest version is via Homebrew:

brew install youtube-dl

Keyboard Maestro “Download video/sound” Macro

Download video-sound.kmmacros (2.5 KB)


Yes, youtube-dl is absolutely great!

1 Like

Thanks @JimmyHartington ! Great idea and macro!

I didn’t know youtube-dl existed. After having used dozens of websites and Chrome extensions to download YouTube videos, I think I finally found the ultimate tool. I adapted your macro to use it with Chrome and, as I regularly download MP3s from YouTube for my teen daughter, I created another macro with the following shell script:

export PATH=/usr/local/bin:$PATH; youtube-dl -x --embed-thumbnail --audio-format mp3 -o '~/Downloads/%(title)s.%(ext)s' $KMVAR_YoutubeLink

The macro will download an MP3 file with the YouTube embed thumbnail as cover art.

Thanks again!



Hey Jimmy,

Well done.  :smile:

I prefer to do the download in the Terminal, so I have progress indicators, etc.

My script here is worth a look:

How can I create a macro that checks for a keyword in highlighted text, if not found, then checks the last clipboard entry and uses it - #7 by ccstone

I'll have to revisit it and look at the various switches you and Cary have demonstrated.

NOTE: I bought a copy of Downie and have been pretty happy with it. I also own a copy of VideoBox.

Because of Downie I don't use my script much anymore.


Hi Chris

I have previosly used this 4K Video Downloader (free).
But since the videofiles are normally small I do not mind not seeing any progress.
Like the fire and forget of the macro. :slight_smile:

// Jimmy

I forgot to mention something very important to download MP3s.

From the youtube-dl documentation:

Convert video files to audio-only files requires ffmpeg or avconv and ffprobe or avprobe

Personally, I installed ffmpeg via Homebrew:

brew install ffmpeg


I use Macports myself.

You must have Macports and Xcode installed.

sudo port install youtube-dl

sudo port install ffmpeg

sudo will require you to enter your password.


Does KM only work with browser-related things if you’re using Safari? or will it work if you’re using Chrome too?

I’m switching from TE to KM, and I had a TE expansion that would pop up and ask for the URL that I’d manually copied from $BROWSER… but if KM reads the URL from the browser session then… KM - WHERE HAVE YOU BEEN ALL MY LIFE?! :open_mouth:


KM has virtually identical support for Safari and Chrome:

See these KM Wiki Searches:

1 Like

Hey Aaron,

Keyboard Maestro only supports Safari and Google Chrome directly, and it can do that because both of these browsers have AppleScript support (which KM uses under-the-hood).

Some other browsers like iCab also have AppleScript support. While KM does not directly support these browsers, it does directly support AppleScript itself – so many things are possible.

Hiding in plain sight for the last 12+ years… :sunglasses:


1 Like

I have closed this topic as it is a spam magnet. @JimmyHartington if you wish to update the macro or whatever, just let me know.