Skip to content

Instantly share code, notes, and snippets.

@johndpope
Created November 23, 2019 12:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johndpope/671f04d1550811649b082e8b9f229d03 to your computer and use it in GitHub Desktop.
Save johndpope/671f04d1550811649b082e8b9f229d03 to your computer and use it in GitHub Desktop.
download youtube to mp3
#! bin/bash
#PREREQ's: Install XCode Command Line Tools, Homebrew, and MacPorts
brew install wget lame #wget retrieves files via HTTP, lame is an MP3 encoder
sudo port install ffmpeg
sudo wget http://youtube-dl.org/downloads/2013.02.25/youtube-dl -O /usr/local/bin/youtube-dl
sudo chmod a+x /usr/local/bin/youtube-dl #make youtube-dl file executable
#make custom bash shortcut. Source: http://alias.sh/youtube-video-mp3-file
echo "mp3(){ youtube-dl $1 --extract-audio --title --audio-format mp3 }" >> ~/.zprofile
source ~/.zprofile
echo "Setup complete! To download, run 'mp3 {link}', where {link} is the YouTube Link"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment