1. Home
  2. Linux

How to listen to Apple Music on Linux

Apple Music is Apple’s answer to Spotify and Google Music. The service works pretty well on iPhone, iPad, macOS, and even Windows. It does not, however, work well on the Linux platform, and Apple has no plans to change this.

Even though Apple Music will never get official Linux support, it is still possible to get a native Apple Music app on Linux with the help of Nativfier.

Install Nativefier

Nativfier is a NodeJS application that can take any website the user points at it and convert it to a native Linux, Windows, or Mac application. To get Apple Music working the Nativefier app must be installed on your system.

Installing Nativefier is a complicated tool to install. If you know how NPM works and already have NodeJS set up on your system, open up a terminal window and enter the command below to get the latest Nativfier installed. Otherwise, follow our guide on Nativefier to learn about how to set up the app, and NodeJS on Linux.

sudo npm install nativefier -g

After running the installation command, you can run nativefier --helpto confirm it works.

Building Apple Music on Linux

Building Apple Music on Linux is a tedious but rewarding process. The process starts by opening up a terminal window and using the CD command to move the command-line session from the home directory (~) to the temporary folder.

cd /tmp

Once inside of the temporary folder on your Linux PC, use the mkdir command to create a new build directory for Apple Music named “apple-music-linux-build-dir.”

mkdir -p mkdir -p apple-music-linux-build-dir

After creating the new Apple Music build folder in the temporary directory, use the CD command to change directories from the temporary folder into the new Apple Music build directory.

cd apple-music-linux-build-dir

The next step in the build process for Apple Music is to download the icon that the program will use on the Linux desktop. To download the Apple Music icon from the internet, copy and paste the following wget download command below into the terminal window.

wget https://i.imgur.com/9ts6pyp.png -O icon.png

The Apple Music icon is done downloading and saved as “icon.png.” We can now use the Nativefier tool to generate a new Apple Music Linux binary in the build folder.

Note: as of writing this guide, the Apple Music Web URL is http://beta.music.apple.com. In the future, it may change. For more information, check the official Apple Music page on Apple.com.

nativefier -p linux -a x64 -i icon.png --disable-context-menu --disable-dev-tools --single-instance http://beta.music.apple.com/

The Nativefier tool will take some time to generate a native Linux binary of the Apple Music webpage. When it’s done, the Apple Music program files will be located in the “apple-music-linux-x64” directory.

Using the mv command, rename the “apple-music-linux-x64” folder to “apple-music.”

mv apple-music-linux-x64 apple-music

Now that the Apple Music folder is renamed, it’s time to move the app’s files from the temporary directory to the “opt” folder. Using the mv command below, move the files into “opt.”

mv /tmp/apple-music-linux-build-dir/apple-music /opt

With the Apple Music files in the “opt” directory on your Linux PC, it is time to update the permissions of the files so that your user can successfully access them. Using the chmod command below, update the Apple Music Linux app’s permissions.

sudo chmod 755 -R /opt/apple-music

The permissions for the Apple Music Linux app are up to date. Now it’s time to create a desktop shortcut to make it easy to launch the app from the Linux desktop. Using the touch command, create a new Apple Music desktop shortcut.

sudo touch /usr/share/applications/apple-music.desktop

Open up the Apple Music shortcut file in the Nano text editor.

sudo nano -w /usr/share/applications/apple-music.desktop

Paste the code below into the Nano text editor. To paste in Nano, press Ctrl + Shift + V.

[Desktop Entry]
Comment[en_US]= Access Apple Music on Linux.
Comment=
Exec=/opt/apple-music/apple-music
GenericName[en_US]=Apple Music desktop app.
GenericName=Apple Music
Icon=/opt/apple-music/resources/app/icon.png
MimeType=
Name[en_US]=Apple Music
Name=Apple Music
NoDisplay=false
Categories=AudioVideo;Audio

Save the edits to the shortcut file with Ctrl + O, and exit Nano with Ctrl + X. Then, update the permissions to the new Apple Music shortcut file.

sudo chmod +x /usr/share/applications/apple-music.desktop

After updating the permissions for the shortcut, open up the app menu on your Linux PC, click on “Audio” or “Multimedia” (or just search for Apple Music) and launch Apple Music. Once the program is open, find the blue “login” button and click it to sign in to your account.

Once signed in to the Apple Music app, you’ll be able to listen to your favorite songs! Enjoy!

Leave a comment