If you want to save a YouTube video to watch offline on your Mac, Terminal gives you a way to do it without using a browser-based downloader. You’ll install a command-line tool called yt-dlp, then paste in the video’s URL. Download videos only when you have permission to do so and the platform’s terms allow it.
Step 1: Install Homebrew (If You Don’t Have It)
Homebrew is a package manager for macOS. If it’s already installed, skip to Step 2. Otherwise, open Terminal from Applications → Utilities and run:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Follow the prompts in Terminal. When installation finishes, follow any instructions Homebrew displays for adding brew to your shell path.
Step 2: Install yt-dlp
Install yt-dlp with Homebrew. Install FFmpeg as well if you want to merge separate video and audio streams or convert audio to MP3:
brew install yt-dlp ffmpeg
yt-dlp is a maintained command-line downloader based on youtube-dl. After installation, you can check that it’s available by running yt-dlp --version.
Step 3: Download a Video
- Find the YouTube video you want to save and copy its URL.
- In Terminal, move to the folder where you’d like the file saved. For example:
cd ~/Downloads. - Run yt-dlp with the URL in quotes:
yt-dlp "https://www.youtube.com/watch?v=VIDEO_ID"
Replace VIDEO_ID with a real video ID, or paste the complete URL between the quotation marks. The file is saved in the folder you selected. The output format can vary according to which video and audio formats are available.
Step 4: Choose Quality or Extract MP3 Audio
To see which formats a video offers, run:
yt-dlp -F "https://www.youtube.com/watch?v=VIDEO_ID"
Then use one of the listed format IDs if you need a specific format:
yt-dlp -f FORMAT_ID "https://www.youtube.com/watch?v=VIDEO_ID"
Replace FORMAT_ID with an ID from that video’s list. Format IDs can differ between videos, so don’t assume one number always means 720p or MP4.
If you only want the audio as an MP3 file, use:
yt-dlp -x --audio-format mp3 "https://www.youtube.com/watch?v=VIDEO_ID"
FFmpeg handles the audio conversion. If you’re exploring audio-focused options, you can also take a look at PDANews YouTube to mp3 converter.
Troubleshooting Tips
- “Command not found”: If
brewisn’t recognized, follow the shell setup instructions shown at the end of the Homebrew installation. Ifyt-dlpisn’t recognized, check that it installed withbrew list yt-dlp. - A download stops working: Update your Homebrew packages with
brew updateandbrew upgrade yt-dlp. YouTube may change how videos are delivered, so a tool update may help. - Audio conversion fails: Check that FFmpeg is installed with
ffmpeg -version. If it isn’t, runbrew install ffmpeg. - Video unavailable: A deleted, private, or otherwise inaccessible video may not be downloadable.
Wrapping It Up
Once yt-dlp and FFmpeg are installed, you can save a video with one Terminal command, inspect its available formats, or extract its audio as MP3. Keep the URL in quotes, especially when it includes additional parameters, and check your Downloads folder when the command finishes.