Skip to content

Instantly share code, notes, and snippets.

@sohamukute
Created March 22, 2026 18:13
Show Gist options
  • Select an option

  • Save sohamukute/076ff3f4a40ee5dbc9acbe226cee2b95 to your computer and use it in GitHub Desktop.

Select an option

Save sohamukute/076ff3f4a40ee5dbc9acbe226cee2b95 to your computer and use it in GitHub Desktop.

Running Apple Music with Lossless Audio on Linux (The Complete Guide)

Tested on: Linux Mint 21 / Ubuntu 22.04 · Xorg · Nvidia GPU


Why Does This Exist?

Apple Music supports lossless audio (ALAC, up to 24-bit/192kHz) but only on Apple's own apps. On Linux, the only official option is the web player, which maxes out at AAC 256kbps. There is no native Linux app.

The trick? Run the Android app inside a container on Linux using Waydroid. The Android app supports lossless audio up to 24-bit/48kHz, real-time lyrics, your full library, and your subscription — all running natively on your Linux machine.


What Is Waydroid?

Waydroid is a container-based approach to running Android inside Linux. Unlike a virtual machine, it shares your Linux kernel directly — so it is lightweight, fast, and audio works properly through your existing PulseAudio/PipeWire setup. Your Apple Music audio comes out through your normal Linux sound system at full quality.


Requirements

  • Ubuntu 22.04 or Linux Mint 21 (or any Ubuntu 22.04-based distro)
  • A paid Apple Music subscription
  • ~4GB free disk space for Android images
  • Internet connection

Nvidia GPU on Xorg? No problem. Waydroid uses software rendering for display. This has zero effect on audio quality.


Step 1 — Load the Binder Kernel Module

Android needs a kernel interface called binder to run. Modern Ubuntu kernels ship it but do not load it by default.

# Check if binder module exists in your kernel
find /lib/modules/$(uname -r) -name "binder*"

# Check compilation options
grep -r "CONFIG_ANDROID_BINDER" /boot/config-$(uname -r)

You will see CONFIG_ANDROID_BINDER_DEVICES="" — this means we need to use binderfs, the modern approach.

# Load the module
sudo modprobe binder_linux

# Mount binderfs
sudo mkdir -p /dev/binderfs
sudo mount -t binder binder /dev/binderfs

# Create real device files (not symlinks — LXC needs real files)
sudo touch /dev/binder /dev/hwbinder /dev/vndbinder
sudo mount --bind /dev/binderfs/binder /dev/binder
sudo mount --bind /dev/binderfs/hwbinder /dev/hwbinder
sudo mount --bind /dev/binderfs/vndbinder /dev/vndbinder

# Verify
ls /dev/binder /dev/hwbinder /dev/vndbinder

Make binder persist across reboots

echo 'binder_linux' | sudo tee /etc/modules-load.d/binder.conf

sudo tee /etc/systemd/system/binderfs.service > /dev/null << 'SVCEOF'
[Unit]
Description=Mount BinderFS
After=local-fs.target
Before=waydroid-container.service

[Service]
Type=oneshot
ExecStart=/bin/mkdir -p /dev/binderfs
ExecStart=/bin/mount -t binder binder /dev/binderfs
ExecStart=/bin/touch /dev/binder /dev/hwbinder /dev/vndbinder
ExecStart=/bin/mount --bind /dev/binderfs/binder /dev/binder
ExecStart=/bin/mount --bind /dev/binderfs/hwbinder /dev/hwbinder
ExecStart=/bin/mount --bind /dev/binderfs/vndbinder /dev/vndbinder
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target
SVCEOF

sudo systemctl daemon-reload
sudo systemctl enable binderfs.service

Step 2 — Install Waydroid

sudo apt install -y curl ca-certificates
curl -s https://repo.waydro.id | sudo bash
sudo apt install -y waydroid

Step 3 — Download the Android Images

sudo waydroid init -s GAPPS -f

This downloads approximately 1.4GB — both a system image and vendor image. Wait for it to complete fully before moving on.


Step 4 — Set Up Networking

sudo ip link add waydroid0 type bridge
sudo ip link set waydroid0 up
sudo ip addr add 192.168.250.1/24 dev waydroid0
sudo iptables -t nat -A POSTROUTING -s 192.168.250.0/24 -j MASQUERADE
sudo iptables -A FORWARD -i waydroid0 -j ACCEPT
sudo iptables -A FORWARD -o waydroid0 -j ACCEPT

Step 5 — Install Weston

On Xorg, Waydroid needs a Wayland compositor to show its window. Weston runs as a normal window inside your Xorg desktop:

sudo apt install -y weston

Step 6 — First Launch

Run these in order, each in its own terminal:

Terminal 1 — start Weston:

WAYLAND_DISPLAY=wayland-1 weston --backend=x11-backend.so --width=1280 --height=800 --socket=wayland-1 &

Wait for the Weston window to appear on screen.

Terminal 2 — start the container service then Android:

sudo systemctl start waydroid-container
sleep 2
WAYLAND_DISPLAY=wayland-1 XDG_RUNTIME_DIR=/run/user/1000 waydroid show-full-ui

Android will boot inside the Weston window. First boot takes 1-2 minutes.


Step 7 — Enable Lossless (The Key Step)

Apple Music only enables lossless over WiFi. Waydroid uses virtual Ethernet, which Android does not recognise as WiFi. This prop tricks it:

waydroid prop set persist.waydroid.fake_wifi "com.apple.android.music"

Step 8 — Install Apple Music via APK

Do NOT use Play Store for Apple Music — it will detect Waydroid as a rooted device and refuse to install. Instead, sideload an older version that has no root check.

  1. Open this in your Linux browser: https://www.apkmirror.com/apk/apple/apple-music/
  2. Download version 3.6.0 — pick the variant with arm64-v8a,x86_64,nodpi
  3. With Android running, install it:
waydroid app install ~/Downloads/com.apple.android.music_3.6.0-*.apk

No output means success. Tap Apple Music on the Android home screen, sign in with your Apple ID, then go to Settings → Audio Quality and set everything to Lossless.


Step 9 — One-Command Startup Script

Create ~/start-applemusic.sh:

#!/bin/bash

echo "Starting Apple Music on Waydroid..."

# Mount binderfs if not already mounted
if ! mountpoint -q /dev/binderfs; then
    sudo mkdir -p /dev/binderfs
    sudo mount -t binder binder /dev/binderfs
fi

# Bind mount binder devices
for dev in binder hwbinder vndbinder; do
    if [ ! -c /dev/$dev ]; then sudo touch /dev/$dev; fi
    if ! mountpoint -q /dev/$dev; then
        sudo mount --bind /dev/binderfs/$dev /dev/$dev
    fi
done

# Set up network bridge if missing
if ! ip link show waydroid0 &>/dev/null; then
    sudo ip link add waydroid0 type bridge
    sudo ip link set waydroid0 up
    sudo ip addr add 192.168.250.1/24 dev waydroid0
    sudo iptables -t nat -A POSTROUTING -s 192.168.250.0/24 -j MASQUERADE
    sudo iptables -A FORWARD -i waydroid0 -j ACCEPT
    sudo iptables -A FORWARD -o waydroid0 -j ACCEPT
fi

# Start container service
sudo systemctl start waydroid-container
sleep 2

# Restart Weston fresh
pkill weston 2>/dev/null
sleep 1
WAYLAND_DISPLAY=wayland-1 weston --backend=x11-backend.so \
    --width=1280 --height=800 --socket=wayland-1 &
sleep 4

# Set fake WiFi for lossless
waydroid prop set persist.waydroid.fake_wifi "com.apple.android.music" 2>/dev/null

# Launch Android
WAYLAND_DISPLAY=wayland-1 XDG_RUNTIME_DIR=/run/user/1000 waydroid show-full-ui

Make it executable and add an alias:

chmod +x ~/start-applemusic.sh
echo "alias applemusic='bash ~/start-applemusic.sh'" >> ~/.bashrc
source ~/.bashrc

From now on, just run:

applemusic

Audio Quality You Get

Tier Status
AAC 256kbps Yes
Lossless ALAC 16-bit/44.1kHz Yes
Lossless ALAC 24-bit/48kHz Yes
Hi-Res Lossless 24-bit/96kHz+ No — Android's audio stack caps at 48kHz output

The 48kHz ceiling is an Android limitation. You are still decoding genuine lossless ALAC — just not outputting above 48kHz. For most listeners and most hardware, 24-bit/48kHz lossless is perfect.


Troubleshooting

"Wayland socket doesn't exist" — Weston died or was never started. Run Weston first.

"WayDroid session is stopped" — Do not use sudo with waydroid show-full-ui. Your user must own the session.

"Only available on unrooted devices" — Do not use Play Store. Sideload the APK as in Step 8.

No lossless option in settings — Run the fake_wifi prop command, then restart the session.

No audio — Check PipeWire: systemctl --user status pipewire


What You Built

You now have the genuine Apple Music Android app running on Linux, authenticated with your paid subscription, streaming real lossless ALAC through your Linux sound system. No private APIs. No reverse engineering. Just the official Android app in a container.

Audio path: Apple servers → ALAC stream → Android app → Waydroid → PipeWire → your DAC

Enjoy the music.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment