Youtube-dl, download Youtube videos on the Mac
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.
The article on this page has generously been submitted by a member of the AppleVis community. As AppleVis is a community-powered website, we make no guarantee, either express or implied, of the accuracy or completeness of the information.
Youtube-dl is a great program. One thing that's definitely worth mentioning is that it can be used not just for downloading from YouTube, but also from many, many other video and audio sites. It can also, for example, download any track, even ones that have downloads turned off, from SoundCloud. You can also download multiple videos/tracks at once. If you paste in a URL to a playlist of videos or the link to a Channel on YouTube, or SoundCloud for that matter, youtube-dl will be more than happy to download all videos/songs it contains. Here is a page describing every command and site supported, which let you do things like ignore errors, set up a proxy, limit download speed or configure how the files are named. This will be a useful reference when setting up your configuration.
youtube-dl works for a lot of things other than just youtube. some of the youtube specific things wouldn't work in that case but it still works well if you only want the video into audio.
also the comment must be made since homebrew is a full and complete package manager you need to keep it up to date.
will do the trick if you run it every week or so.
This guide is great, however the link from which Homebrew is available doesn't work, at least for me. Safari simply says it cannot find the server.
Thanks so much. This has been updated.
Sorry about the OT question, but...
Is there a similar app on IOS that could do such a thing? that is download videos from many places?
just like youtube dl.
Security options would be neat to have but are not mendatory.
I would take any free apps with adds,but if there are none I would take a payed recommendation just as well...
I just got round to trying this out properly. I'm trying to convert a video to an MP3 file using the commands you provided but it doesn't seem to be working. Here is what I'm typing:
youtube-dl -x --audio-format mp3 https://www.youtube.com/watch?v=d07vmvuZtvY
That URL is the video I'm trying to convert. Once I enter that command and press return, VoiceOver announces "Downloading webpage", followed by "Downloading video info webpage", followed by what seem to be a random bunch of numbers every few seconds, then it says something not installed, please install one then returns me back to the standard terminal prompt. This "something" sounds like "RR Prober" but I could be wrong.
A file did download in the directory I specified, but it was not an MP3 file.
Any ideas? I have already tried entering the URL in quotes and got the same result.
Try interacting with the text area, and using VOICEOVER+up arrow to see what to install, then do brew install with that. For example, if it wants ffmpeg, do
brew install ffmpeg
that's only a guess, though. You can also use voiceover+shift+left or right arrow to read by character when navigating within text fields that don't support actual arrow navigation.
Thanks for your reply. I have navigated the output by character and it says "ffprobe or avprobe not found. Please install one." Brew install ffprobe and brew install avprobe both result in errors.
ffprobe is a part of ffmpeg, so that's what you need to install.
brew install ffmpeg should do it. That's f f m p e g.
Thanks so much. I installed fmpeg and it's working brilliantly now.
Hi. So I installed the program and did everything that was mentioned in the guide, but whenever I convert something to mp3, it says extraction error. I installed FFmpeg, So I'm not sure what's up.
Please correct me if I am wrong, it seems established now that youtube-dl no longer downloads from youtube. It had been working without a hitch, but a few weeks ago, kaput.
So I am wondering, how is the app Any Video Converter able to pull it off? If the app can do it, there must be a way to do it using basic utilities like youtube-dl.
Is there another command line solution for downloading videos from YouTube?
Have you updated it? I used it yesterday and it worked.
You can also eliminate the ID from the video as well. I forgot how to do it but I'll look in my .bash_profile as I created an alias to do this.
I heard about that, and github took a stanse against the take down. I'm on windows so not sure if I can do sudo, but I"ll figure it out.
TO update it on windows, just write youtube-dl /U and press enter
Yep, did that a few weeks ago. I also update via apt-get anyway on mac, so I don't need to worry much.
It's best to check every couple of weeks.
Once I had my batch files set up; and ffmpeg installed, everything worked fine, it's as simple as coppying a URL, putting it into the batch file, running it and sitting back and relaxing.
I wonder if I could make things even easier for me...
I have 2 batch files, one for playlists and one for only single videos.
I wonder if I can make them into one kind of program and make it so, if you press 1 it takes you to the convert only 1 video part and 2 for playlists? Along with a message letting me paste my url into the command line box?
I think it's doable; I just have no idea how.
Hi, Whenever I try to download a url and convert it to audio with the instructions presented here, I've been getting a no matches found mesage for some reason.
try youtube-dl -f audio then the URL
I think I have that syntax right. I have to do that for the video from facebook
youtube-dl -f Best
A faster alternative is, YT-DLP
Simply use pyyoutube python module and download not only video and also audio.