setup youtube-dl destination to ~/Downloads

Solution 1:

youtube-dl Config File

To set a default download location, create a youtube-dl configuration file at:

~/.config/youtube-dl/config

Within this file enter the line:

-o ~/Downloads/%(title)s-%(id)s.%(ext)s

You can create this file using the following two commands:

mkdir -p ~/.config/youtube-dl/
echo "-o ~/Downloads/%(title)s-%(id)s.%(ext)s" > ~/.config/youtube-dl/config

The first command mkdir, creates the folders leading to the configuration file. The second command echo writes the output option into the file.

Options set within your configuration file are applied to every call to youtube-dl. Use the --ignore-config option to disable reading of the configuration file.

Solution 2:

It doesn't download to your home, but to the current working directory. Change it before you want to download. If you're using bash, you might want to create a function in your .bashrc like this:

function youtube-dl ()
{
    cd ~/Downloads/ && {
        `which youtube-dl` "$@"
        cd - > /dev/null
    }
}

This changes the working directory to the Downloads folder in your home, runs the original youtube-dl with the command line arguments you passed to the function and then changes the directory back.

You also may want to have a look at this: How do I run a program with a different working directory from current, from Linux shell? as this also applies to OS X.