English | 简体中文 | Cloud Server / Proxy Setup
Original script by Sorrow. Modified with fixes and improvements.
This command-line tool downloads albums, songs, playlists, stations and music videos from Apple Music, preserves or embeds metadata and lyrics, and supports ALAC, AAC and Dolby Atmos. Use it only with content you are entitled to access and in accordance with Apple's terms and applicable law.
- Features
- Supported formats
- Requirements
- Configuration
- Install on Windows
- Install on macOS
- Install on Linux
- Install on Android with Termux
- Usage
- Get media-user-token
- Lyrics options
- Upgrade
- Credits
- Inline cover art and LRC lyrics.
- Word-by-word and unsynchronized lyrics.
- Artist album downloads.
- Streaming download and decryption for large files.
- Music-video downloads using in-process mp4ff decryption.
- Interactive search and track selection.
| Format | Description | Requires subscription |
|---|---|---|
alac |
audio-alac-stereo |
Yes |
ec3 |
audio-atmos / audio-ec3 |
Yes |
aac |
audio-stereo |
Yes |
aac-lc |
audio-stereo |
Yes |
aac-binaural |
audio-stereo-binaural |
Yes |
aac-downmix |
audio-stereo-downmix |
Yes |
MV |
Music video | Yes |
Stations require a valid media-user-token from an active subscription.
Install these before running the downloader:
- Go 1.23.1 or newer: go.dev/dl.
- MP4Box / GPAC: gpac.io/downloads/gpac-nightly-builds/. Ensure
MP4Boxis available inPATH. - wrapper-lite: github.com/WorldObservationLog/wrapper/tree/lite. Start it before using this downloader and set its HTTP endpoint in
lite-server, for examplehttp://127.0.0.1:12340. - ffmpeg: required only for post-download conversion, animated artwork, or
ffmpeg-dependent features. See ffmpeg.org.
Copy the example config to config.yaml in the project root:
cp config.yaml.example config.yamlOn Windows PowerShell, use:
copy config.yaml.example config.yamlAt minimum, review and set:
# wrapper-lite HTTP API endpoint.
lite-server: "http://127.0.0.1:12340"
# Required for stations. See "Get media-user-token" below.
media-user-token: "your-media-user-token"
# Destination folders. Relative paths are resolved from the working directory.
alac-save-folder: "AM-DL downloads"
atmos-save-folder: "AM-DL-Atmos downloads"
aac-save-folder: "AM-DL-AAC downloads"
mv-save-folder: "AM-DL-MV downloads"
# Required for ffmpeg-based conversion or animated artwork.
convert-after-download: false
save-animated-artwork: falseIf wrapper-lite runs on another machine or container, replace 127.0.0.1 with that host's reachable LAN or public address.
- Install Git: git-scm.com/download/win.
- Install Go 1.23.1 or newer: go.dev/dl.
- Install GPAC from the official download page and make sure
MP4Box.exeis available inPATH. - Install ffmpeg if you plan to convert files or save animated artwork: ffmpeg.org/download.html.
From PowerShell:
git clone https://github.com/zhaarey/apple-music-downloader.git
cd apple-music-downloader
copy config.yaml.example config.yaml
go build -o amdl.exe .
.\amdl.exe --helpExample:
.\amdl.exe "https://music.apple.com/us/album/whenever-you-need-somebody-2022-remaster/1624945511"- Install Homebrew: brew.sh.
- Install the runtime and media tools:
brew install go git gpac ffmpegThen clone, configure and build:
git clone https://github.com/zhaarey/apple-music-downloader.git
cd apple-music-downloader
cp config.yaml.example config.yaml
go build -o amdl .
./amdl --helpExample:
./amdl "https://music.apple.com/us/album/whenever-you-need-somebody-2022-remaster/1624945511"Choose the commands for your distribution. Package names may differ on other distributions.
sudo apt update
sudo apt install -y git build-essential gpac ffmpegIf your repository's Go package is older than 1.23.1, install Go from go.dev/dl instead of using the distro package.
sudo dnf install -y git gcc make gpac ffmpegIf needed, install Go manually from the official site.
sudo pacman -S --needed git base-devel gpac ffmpegIf needed, install Go manually from the official site.
Then clone, configure and build:
git clone https://github.com/zhaarey/apple-music-downloader.git
cd apple-music-downloader
cp config.yaml.example config.yaml
go build -o amdl .
./amdl --helpExample:
./amdl "https://music.apple.com/us/album/whenever-you-need-somebody-2022-remaster/1624945511"Install Termux from F-Droid or the official GitHub releases. Do not use the outdated Play Store build.
- Update the package index and installed packages:
pkg update && pkg upgrade- Install the toolchain and media tools:
pkg install golang git gpac ffmpeg- Optionally grant access to shared Android storage. Termux creates the
~/storage/sharedtree after you approve the prompt:
termux-setup-storage- Clone, configure and build:
git clone https://github.com/zhaarey/apple-music-downloader.git
cd apple-music-downloader
cp config.yaml.example config.yaml
go build -o amdl .- To save into Android shared music storage, point the save folders at the shared storage mount:
alac-save-folder: "/sdcard/Music/amdl"
atmos-save-folder: "/sdcard/Music/amdl-atmos"
aac-save-folder: "/sdcard/Music/amdl-aac"
mv-save-folder: "/sdcard/Music/amdl-mv"Run normally:
./amdl "https://music.apple.com/us/album/whenever-you-need-somebody-2022-remaster/1624945511"For long downloads, keep Android from suspending Termux:
termux-wake-lockRelease the lock when finished:
termux-wake-unlockIf wrapper-lite runs on another device, set lite-server to that device's LAN or public address, not 127.0.0.1. These instructions target current Android arm64 Termux environments; 32-bit Android is not a documented target.
Before running any command, make sure:
- wrapper-lite is running.
config.yamlexists and has the correctlite-servervalue.MP4Boxis available inPATH.
go run . "https://music.apple.com/us/album/whenever-you-need-somebody-2022-remaster/1624945511"Or use the built binary:
./amdl "https://music.apple.com/us/album/whenever-you-need-somebody-2022-remaster/1624945511"./amdl "https://music.apple.com/us/album/never-gonna-give-you-up-2022-remaster/1624945511?i=1624945512"
./amdl "https://music.apple.com/us/song/you-move-me-2022-remaster/1624945520"./amdl --all-album "https://music.apple.com/us/artist/taylor-swift/159260351"./amdl "https://music.apple.com/us/playlist/taylor-swift-essentials/pl.3950454ced8c45a3b0cc693c2a7db97b"./amdl --select "https://music.apple.com/us/album/whenever-you-need-somebody-2022-remaster/1624945511"Enter track numbers separated by spaces.
./amdl --search album "never gonna give you up"
./amdl --search song "you move me"
./amdl --search artist "taylor swift"./amdl --atmos "https://music.apple.com/us/album/1989-taylors-version-deluxe/1713845538"./amdl --aac "https://music.apple.com/us/album/1989-taylors-version-deluxe/1713845538"./amdl --debug "https://music.apple.com/us/album/1989-taylors-version-deluxe/1713845538"--alac-max <sample-rate>
--atmos-max <bitrate>
--aac-type <aac|aac-lc|aac-binaural|aac-downmix>
--mv-max <resolution>
--mv-audio-type <atmos|ac3|aac>
--lite-server <wrapper-lite-url>
media-user-token is required for stations.
- Open Apple Music and sign in.
- Open browser developer tools with
F12. - Go to
Application>Storage>Cookies>https://music.apple.com. - Find the cookie named
media-user-tokenand copy its value. - Paste it into
media-user-tokeninconfig.yaml. - Restart the downloader.
Key settings in config.yaml:
lrc-type: "lyrics" # lyrics or syllable-lyrics
lrc-format: "lrc" # lrc or ttml
lrc-extra: "" # translation or pronunciation
embed-lrc: true # embed lyrics in the media file
save-lrc-file: false # also save an external .lrc fileSet lrc-extra according to the service's language or feature code when you want translated or phonetic lyrics.
Pull the latest source and rebuild:
git pull
go build -o amdl .On Windows:
git pull
go build -o amdl.exe .If config.yaml.example gains new options, compare it with your config.yaml before copying anything. Preserve your existing credentials and save folders.
- Sorrow created the original script.
- WorldObservationLog created wrapper / wrapper-lite, used as the backend decryption service.
- Sendy McSenderson contributed the streaming download-and-decrypt implementation.
- GPAC provides
MP4Box. - FFmpeg supports optional conversion and animated-artwork features.