In this guide, I’ll be showing you how to use Youtube-dl, the Youtube-downloader, to download a single video, multiple videos, and how to customize Youtube-dl.
Youtube-dl is a free tool which is run from the terminal, but I’ll try to make the mysterious Terminal as friendly as possible. First, let’s gather the software we need.
Homebrew: the Terminal’s App store
Homebrew, found at this site is a "Package manager" which essentially means that it is an app store. Linux lovers may feel disdain for such a term describing a package manager, but this post isn’t for those who are natives to the Terminal, or "console." This post is for those who are Mac users, comfortable with beautiful interfaces that just work. So, let’s get to it. First, find the Terminal app, in the Utilities folder of Finder. and open it. You should hear plenty of gibberish from VoiceOver, ending with your username, then a dollar sign. This means that Terminal is prompting you for a command. Commands are simply program names, like "cp" for copying files, "rm" for deleting files, and "nano" for editing simple text. All these programs are commands, and you just type them in to run them. Many commands have "arguments" or options which can be typed after the command name. For example, if you have a file named test.txt, you can type nano test.txt to open it. Now, we know how to run things, so let’s install an app store! Go to the Homebrew site, and find the command to return into the Terminal. It Will start with /usr/bin/ruby. Copy that whole line to the clipboard, and paste it into Terminal, and press return if necessary. You’ll know if you need to press return if nothing happens. VoiceOver will automatically read what’s happening as the program runs. The installer will download Homebrew, and install it for you. Now, you have the brew program you can use, you’ve leveled up!
Now that you have Homebrew installed, you can use the brew command to manage your packages, or "apps" if you prefer. If you need help with Homebrew, and you search the Internet, the proper term is "package" not "app," but I said I’d make this guide friendly. Now, let’s see how to install something. brew install youtube-dl This command installs the youtube-dl program, which is what you came here to learn about. let’s take this command apart to see what all it does. brew: This is the Homebrew program. Brew is the name of the program, shortened because most people like typing as little as necessary to get commands to run. install: This instructs the brew program on what we want it to do. youtube-dl: This is what we want it to install. Brew will download the package, and run its installer, just like the app store. Now, type the above command into the Terminal, with spaces between each word. If you mess up, nothing will break, Brew will just tell you that something was wrong with what you wrote. Now, brew should be installing youtube-dl. You’ll know when its done when you hear your username, and the dollar sign again. If not, try running brew install youtube-dl again. If you must, copy and paste the command, although typing it out is recommended so that you get used to writing commands.
From time to time, packages may be updated. To get updates, run brew upgrade Youtube-dl makes updates at least once a month, and sometimes weekly, or even daily.
a little more about the Terminal
Let’s talk about folders now. When you download videos, you’ll want to put them into a certain place, right? And moving them manually from the Finder would be a pain, right? Well, maybe you’d like the arduous work of moving things from Finder, but I don’t. So, we’ll learn how to move through folders, or "directories."
- cd: Change directory
- ls: list
- cp: copy
- rm: remove
- mkdir: Make directory
Here, we have some of the most important basic Terminal commands. Practice them frequently, and you’ll be able to move around directories, and keep things more organized.
Putting youtube-dl to some use
Now, we’re ready to download a video, finally. Find a video on Youtube that you’d like to download, and copy its address. To do this, press Command + L, then Command + A, then Command + C. Open the Terminal, and type youtube-dl then press the Space bar, then command + V, and return. Now, the video starts downloading, within the current directory. You’ve now downloaded your first video. But what about just audio? With the same video link in the clipboard, open the Terminal and type youtube-dl as before, but this time after pressing space, type -x --audio-format mp3 then paste the URL and press return. This tells youtube-dl to extract the audio from the video, then convert it to mp3. Now, you have all this to type: youtube-dl -x –audio-format mp3 http://www.youtube.com A bit much, right?
If the download doesn't work for some reason, and the Youtube address has an ampersand character in it, enclose the address in quotes.
Imagine having to set up a program each time you run it. Sure, typing commands isn’t as hard as navigating screens with VoiceOver, but it can still be a lot to remember. That’s what configuration files are for. They allow one to set options for a program and forget it. Youtube-dl can use a configuration file, as well. You’ll have to make it, but that’s not too hard mkdir ~/.config/youtube-dl/ touch ~/.config/youtube-dl/config Now, you can open the configuration file in your favorite editor, I use Emacs, so: emacs ~/.config/youtube-dl/config You can substitute Emacs with any other editor you like: Nano, Vim, and so on. Here, you write the arguments that you normally would write before the Youtube address. Write the following into the file: -x –audio-format mp3 Then, with Emacs, press Control + X, then Control + S, then Control + X, then Control + C to save the file, and exit Emacs. There, now you only have to go to the Terminal and type youtube-dl then paste the address. Another good use for the configuration file is to sign into Youtube as well. put this into the file: -u username -p password Replace username with your Youtube email address, and password with the account password. All of these "arguments" should be on one line: -x –audio-format mp3 -u username -p password Now, when you download a video, it may count as a view for the video so that the creator gets more views, and you get a good, accessible MP3 file.
There is a way to search Youtube, and download the results, right from Youtube-dl. youtube-dl "gvsearch15:search terms" This searches Youtube for "search term" and downloads the first 15 results. Change this to your liking, and practice often to get better at typing this command, and understanding how it works. Notice that there is a quote sign before gvsearch, and after the last search term, and a colon before the first search term.
This guide is a great start for those who want to download Youtube videos from a Mac, for free, and with guaranteed accessibility. The learning curve may be more steep than most Mac software, but it is well-worth the time and effort you put into it.