Download Your Google Music Library in Terminal with Gmpydl on Linux

Google Music is a great service. Along with the ability to purchase from their extensive library, you can store up to 50,000 of your own music files. Unfortunately, the software behind Google Music on Linux is less-than-stellar. Luckily, there’s a command-line alternative. Here’s how it works.

Before Gmpydl can work, you’ll need to install the unoffical Google Music API on your system. This can be done by opening a terminal window and entering the following commands:

sudo apt-get install python-pip git
git clone https://github.com/simon-weber/gmusicapi.git

gmpydl-git-clone-gmusic-api

cd gmusicapi
sudo pip install gmusicapi

Note: other Linux distributions may need to use Pip2 or a package with a similar name.

Gmpydl is a git package, so you’ll have to use the git tool to get the source files. Enter this command to clone it to your local file system.

git clone https://github.com/stevenewbs/gmpydl.git

gmpydl-git-clone-gmpydl

Once the package is cloned, just enter the directory with the cd command.

cd gmpydl

From here, Gmpydl should work just fine. All you’ll need to do to launch it is this simple command:

sudo ./gmpydl.py

gmpydl-help-dialog-area

Downloading music through Gmpydl works well. The program works with the help of a user-created interface, so things can be a little unstable at times. Still, if you’re fed up with Google’s implementation, this is a good option. Here’s how it works: when sudo ./gmpydl.py is run via the terminal, you’ll be brought through a setup process.

This setup process involves entering your Google account email address. Don’t worry; this program works with Oauth, so you will not need to share your password info with Gmpydl. Just enter your email. From here, the program will ask where music should be downloaded. Enter ~/Music (or specify another directory). With the directory entered, a URL will be generated. Just open this URL link in your browser.

gmpydl-oauth-url-link

On the page that the terminal generated, you’ll need to allow some things. Specifically, you’ll need to grant Gmpydl authorization to your Google account. The page will tell you that Gmpydl only wants to interact with the Music section of Google. Select the “Allow” option to proceed.

gmpydl-authorize-account-google

Once you’ve been granted access, you’ll be given an authorization code to enter. Copy it to your clipboard, paste it into the terminal and press the Enter key. After all the setup configuration is taken care of, just enter the command below to start downloading music.

sudo ./gmpydl.py ~/Music

This command alone should be all you need. However, since this program can be unstable, you may run into times where you’ll need to kill the script (with Ctrl + Z) and start it again. Since downloading via Google Music depends on your entire collection, it’ll start downloading every music file you own.

gmpydl-downloading-music

This can be a huge issue if you already have certain files downloaded through Gmpydl. To prevent re-downloading if you need to re-execute the program, enter this command instead of the one above:

sudo ./gmpydl.py -n ~/Music

This little -n switch is very useful. Basically, it’ll scan all your downloaded files and create a list of the ones that have already been downloaded. That way, when running the command above, you only download music files that aren’t on your system already.

Google Music Manager for Linux is a terrible program. Sure, it does what it’s designed to do, but Google rarely updates it or fixes the bugs it has. In fact, if you don’t know how to get around it, you may run into some crippling issues regarding uploading and downloading music.

This is why I’m very happy that Gmpydl exists. Even though it only does downloads, it’s a worthy alternative that allows users to get away from the official  program at least some of the time. One day I hope the developer of this program wI’ll add the ability to upload music. Until then, this will have to do.