Download YouTube audio for the macOS Music app.

By default, yt-audio saves .m4a (AAC) files to ~/Downloads, with available

metadata, chapters, and cover art. Other formats are available with -f.

Install with Homebrew from the rib3ye tap:

brew install rib3ye/tap/yt-audioHomebrew installs yt-dlp, ffmpeg, and atomicparsley automatically.

To update, run brew upgrade yt-audio yt-dlp.

To uninstall, run brew uninstall yt-audio.

yt-audio <youtube-url> [more-urls...]Examples:

# Single track → ~/Downloads/

yt-audio "https://www.youtube.com/watch?v=jNQXAC9IVRw"

# Download and import straight into the Music app

yt-audio -a "https://www.youtube.com/watch?v=..."

# Pick the output directory

yt-audio -d ~/Music/Imports "https://www.youtube.com/watch?v=..."

# Pick the output format (default: m4a)

yt-audio -f mp3 "https://www.youtube.com/watch?v=..."

# Grab a whole playlist (off by default — a single video is downloaded otherwise)

yt-audio --playlist "https://www.youtube.com/playlist?list=..."To save your defaults, add these environment variables to ~/.zshrc:

export YT_AUDIO_DIR="$HOME/Music/Imports"

export YT_AUDIO_FORMAT=mp3All listed formats support --add. For m4a, yt-audio copies native AAC streams

without re-encoding.

YouTube audio is lossy. The alac and wav formats avoid another lossy

encode, but cannot restore lost quality.

To install manually, run these commands from the repository directory:

brew install yt-dlp ffmpeg

mkdir -p ~/.local/bin

install -m 755 yt-audio ~/.local/bin/yt-audioIf ~/.local/bin is absent from your PATH, add this line to ~/.zshrc:

export PATH="$HOME/.local/bin:$PATH"Open a new terminal to use yt-audio from any directory.

After changes to the script, repeat the install command to update the copy.

To uninstall the manual copy, run rm ~/.local/bin/yt-audio.

MIT © Noah Tsutsui