Manage Apple Music from your terminal. Create playlists, import songs, and control your library with simple commands.
- π΅ List playlists - View all your Apple Music playlists
- β Create playlists - Make new playlists instantly
- π₯ Import songs - Bulk import from text/CSV files
- π Add songs - Search and add from your library
- ποΈ Delete playlists - Clean up your collection
- π Show tracks - List contents of any playlist
- π Retry logic - Automatically retries failed AppleScript calls
- π Progress tracking - See import progress with summary reports
# Clone the repository
git clone https://github.com/YOUR_USERNAME/apple-music-cli.git
cd apple-music-cli
# Install to local bin
mkdir -p ~/.local/bin
cp bin/am-cli ~/.local/bin/am
chmod +x ~/.local/bin/am
# Add to PATH if needed
export PATH="$HOME/.local/bin:$PATH"brew tap your-tap/apple-music-cli
brew install apple-music-cli- macOS with Music app (pre-installed)
- Python 3.x (pre-installed on macOS)
- Active Apple Music subscription (for songs to be available)
# List all your playlists
$ am list
# Create a new playlist
$ am create "Workout Mix"
# Show playlist contents
$ am show "Workout Mix"
# Delete a playlist
$ am delete "Old Playlist"Create a text file with one song per line:
$ cat songs.txt
Queen - Bohemian Rhapsody
The Beatles - Hey Jude
Led Zeppelin - Stairway to HeavenThen import:
$ am import "Workout Mix" songs.txt
π Importing 3 songs to 'Workout Mix'
π΅ Activating Music app...
π Loading current playlist...
Playlist has 0 songs
[01/03] Searching: Queen - Bohemian Rhapsody
β Song not found in library
[02/03] Searching: The Beatles - Hey Jude
β Song not found in library
[03/03] Searching: Led Zeppelin - Stairway to Heaven
β Song not found in library
==================================================
π IMPORT SUMMARY
==================================================
β
Added: 0
β Not Found: 3
β οΈ Errors: 0
βοΈ Skipped: 0
Total: 3
π Results saved to: ~/am_import_Workout_Mix_20260222_114030.json$ am add "Favourites" "Queen"
π Searching: Queen
To playlist: Favourites
β
Added: Bohemian Rhapsody - QueenTo search the full Apple Music catalog (95M songs) and add any song, you need:
- Apple Music API access
- $99/year Apple Developer Program membership
This is a deliberate Apple limitation, not a bug.
am/
βββ bin/
β βββ am-cli # Main CLI executable
βββ SKILL.md # OpenClaw skill documentation
βββ _meta.json # Skill metadata
βββ LICENSE # MIT License
βββ README.md # This file
- AppleScript Bridge: Communicates with Music app via
osascript - Retry Logic: Automatically retries failed AppleScript calls (max 3)
- State Persistence: Saves import results to JSON for later review
- Error Handling: Gracefully handles failures, continues processing
- Language: Python 3
- Interface: CLI via
argparse - Apple Integration: AppleScript (
osascript) - License: MIT
- β Playlist CRUD via AppleScript
- β Song import from file
- β Retry and error handling
- π² Apple Music API integration
- π² Search full catalog (95M songs)
- π² Add songs from catalog to library
- π² Cross-platform sync (Spotify, YouTube Music)
- π² Smart playlists
- π² API for automation
- π² Web UI
# Clone repo
git clone https://github.com/YOUR_USERNAME/apple-music-cli.git
cd apple-music-cli
# Test locally
python3 bin/am-cli list
# Run tests
# (coming soon)| Feature | Apple Music App | am CLI |
|---|---|---|
| GUI | β | β |
| Bulk import from file | β | β |
| Automation/scriptable | β | β |
| Cross-platform (w/ API) | β | β (future) |
| Terminal-native | β | β |
| Project | Language | Notes |
|---|---|---|
| ryanccn/am | Rust | Playback control, Discord Rich Presence |
| mcthomas/Apple-Music-CLI-Player | Shell | Basic controller script |
| Cider | Electron | Paid ($3.99), GUI client |
The song must be in your Apple Music library (downloaded or purchased). This tool cannot search the Apple Music streaming catalog without API access.
Solution: Add the song to your library in the Music app first.
# Test AppleScript manually
osascript -e 'tell app "Music" to activate'
# If that fails, check:
# 1. Music app is installed
# 2. Music app is not restricted
# 3. osascript is available: which osascriptIf you see permission errors, grant Terminal access to:
- System Settings β Privacy & Security β Automation β Terminal
- System Settings β Privacy & Security β Apple Events β Terminal
MIT License - see LICENSE file
Pull requests welcome! Areas for contribution:
- Apple Music API integration
- Better error messages
- More import formats (CSV, JSON)
- Cross-platform support
- Tests
- Inspired by ryanccn/am
- Built for the OpenClaw ecosystem
- ryanccn's work showed the potential, this extends it
Built with π΅ by OpenClaw