grep jason_

My youtube-dl Setup

FYI (updated: 2021-05-28)
Some things have changed with the move to Apple Silicon. Updates below.

FYI (updated: 2021-10-08)
If you are experiencing issues with youtube-dl like slowdowns (it looks like the project is not currently actively being maintained) you might try this fork of the project yt-dlp

I also simplified my setup to all live within a single .sh script instead of using config files. Makes it a one stop shop (file) when you need to make updates.


The YouTube apps on the various platforms (iOS, Apple TV, web, and so on) are ok. I was looking for a better way to watch videos that I saved to view later (especially with pip on the iPad). There is a utility called youtube-dl that you may or may not have seen mentioned online. Here is a rundown of how I am now using it to manage all my YouTube videos I want to watch.

youtube-dl Configuration

The youtube-dl utility can be downloaded here:
Check out the documentation on youtube-dl to get it all setup for your platform. Then it's time to setup the configuration.

The yt-dlp utility can be downloaded here:
Check out the documentation on yt-dlp to get it all setup for your platform.

Since my intial setup, I have moved away from a separate configuration file. No technical reason, just made thing a little simpler with everything baked into the shell script instead. But, if you would like to have your config in a separate file, here is an example of one.

I still recommend using a separate archive.txt file though so you don't end up re-downloading your entire playlist every time!

youtube-dl.conf (I am not using a standalone config anymore. Just the .sh below)
Located here: /private/etc/youtube-dl.conf
Plus ~/archive.txt to keep an archive and only download videos that have not already been downloaded.
There is an ffmpeg line for Intel and one for Apple Silicon. Remove the one you don't need.

# Save all videos to download folder
-o /Volumes/LaCie/Media/YouTube/%(title)s.%(ext)s

# Mark video as watched

# download playlist

# Dowload new videos only
--download-archive ~/archive.txt

# Download best quality
-f 299+140/137+140/best

# ffmpeg location (Intel)
--ffmpeg-location /usr/local/Cellar/ffmpeg/4.4.1/bin/ffmpeg

# ffmpeg location (Apple Silicon)
--ffmpeg-location /opt/homebrew/Cellar/ffmpeg/4.4.1/bin/ffmpeg

Simplified .sh (mentioned in my 2021-10-08 update above)

If you go this route, you don't need a separate config file.

 -o "/Volumes/LaCie/Media/YouTube/%(title)s.%(ext)s"\
 -f "299+140/137+140/best"\
 --ffmpeg-location "/opt/homebrew/Cellar/ffmpeg/4.4.1/bin/ffmpeg"\
 --download-archive ~/archive.txt\

Be sure to make this .sh executable: chmod +x

Automating The Setup

Launch Agent (download_videos.plist)
A simple .plist that is placed in /Library/LaunchAgents set to run the .sh every 60 seconds. There is also a .log file in this example that I use to check when things aren't working. Very handy!

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">

This is all running on a 2018 Mac mini that is always on.
This is all running on a 2021 M1 iMac that is always on.
This is all running on a 2020 M1 Mac mini server that is always on.

Plex Viewing

Now that the videos are being saved to a YouTube folder on the LaCie 6Big, this is where Plex comes in. This folder is monitored by Plex and updated with new videos so I can watch them right in the Plex app on iPhone, iPad, Mac, AppleTV, really anywhere you can get Plex running.

Managing the videos that are on the 6Big Storage.
Once I am done watching a video, Plex has an option to delete the video, which will delete the actual file on the server, so this keeps the folder from getting too out of control.

That's it! Simply add a video to the "ytdl" playlist on YouTube and this handles the rest!

Side Note - Alfred Workflow

Because youtube-dl is so useful and supports many different video platforms, I also have an Alfred workflow that I use for one-off downloads. Since this workflow is different from what I want the above system to accomplish with a YouTube playlist, I have set this up slightly different.

I don't want the videos downloaded via this workflow to go to the same YouTube folder on the LacIe, so I decided to go with a one off config just for this workflow, it looks like this:

(Intel) youtube-dl -o "~/Downloads/%(title)s.%(ext)s" -f "299+140/137+140/best" --ffmpeg-location "/usr/local/Cellar/ffmpeg/4.3_2/bin/ffmpeg" --ignore-config "{query}"

(Apple Silicon) youtube-dl -o "~/Downloads/%(title)s.%(ext)s" -f "299+140/137+140/best" --ffmpeg-location "/opt/homebrew/Cellar/ffmpeg/4.4_1/bin/ffmpeg" --ignore-config "{query}"

This ignores my standard config file and sets the download location to 'Downloads'.

  1. Copy the video URL to clipboard
  2. Trigger Alfred
  3. Use the keyword yt followed by pasting the video URL
  4. Hit enter and your video begins downloading!

YouTube-dl Alfred Workflow

iOS Shortcut

I realized I didn't have a way to complete the workflow if I got a link on my iPhone / iPad, so here is a shortcut to fix that.


  • If your automated downloads stop and you are getting an error in the console related to keyerror: u'content_html' the issue may be that your YouTube playlist has gotten too large. This happened to me and my list was over 400 items! 😱 Probably a good idea to clean that list up from time to time. 👍