YTM - YouTube Music CLI
🎵 A simple, interactive command-line tool for YouTube Music
Stream music directly from YouTube Music in your terminal with intuitive controls, playlist management, and smart filtering.
Player UI with the real-time FFT spectrum visualizer (synthetic demo capture). Click for the higher-quality .webm.
✨ Features
- 🔍 Smart Search: Search and play any song from YouTube Music
- 🎮 Interactive Controls: Play/pause, skip, go back with simple key presses
- 📱 Vim-like Navigation: Use
j/kkeys or arrow keys to navigate - ♥ Local Favorites: Toggle favorite songs instantly with
f - 📋 Local Playlists: Create and manage personal playlists
- 👎 Smart Filtering: Dislike songs to filter them from future results
- 📜 Synced Lyrics: Live-highlighted lyrics with auto-scroll (press
l) - 🎯 Radio Mode: Automatic playlist generation based on your selection
- 📊 Real-time Spectrum Visualizer: 24-band FFT bars in both player layouts, driven by an
ffmpegsidecar with animated fallback bars when live data is unavailable - 🤖 AI-Powered: Natural language music requests and AI-generated playlists
🚀 Quick Start
Requirements
- macOS (the only platform maintained for now)
- Python 3.10+ (set in
pyproject.toml) - mpv media player, installed system-wide:
brew install mpv ffmpegonPATHfor the real-time spectrum visualizer:brew install ffmpeg(optional — falls back to animated bars if missing)
Installation
One command with uv (recommended):
# Install from PyPI — gets latest version automatically
uvx ytm-cli "song name"
Alternative: clone and run locally
git clone https://github.com/thieuluan1618/ytm.git
cd ytm
uv run ytm-cli "song name"
Alternative: one-shot setup script (macOS)
git clone https://github.com/thieuluan1618/ytm.git
cd ytm
./setup.sh
source ~/.zshrc # or ~/.bashrc for bash
This creates the venv, installs runtime deps from pyproject.toml, and adds a ytm shell alias.
Alternative: manual install
git clone https://github.com/thieuluan1618/ytm.git
cd ytm
uv sync # installs runtime deps from pyproject.toml + uv.lock
./setup_alias.sh # optional: registers the `ytm` alias
# Run with: uv run ytm-cli "song"
Platform support: macOS is the only platform maintained for now. Linux and WSL2 may still work but aren't maintained. Native Windows is not supported (the codebase uses POSIX-only
termios/tty/fcntl).
Basic Usage
Interactive search:
ytm-cli
# Enter search query when prompted
Direct search:
ytm-cli "your favorite song"
Non-interactive mode (automation/scripting):
ytm-cli search "song name" --select 1 # Auto-select first result
ytm-cli search "song" -s 1 --verbose # With verbose output
ytm-cli search "song" -s 1 --verbose --log-file debug.log # Save debug logs
ytm-cli -v # Print version
ytm-cli --update # Update the app and dependencies
Tip: Set up the shell alias to use
ytmas a shortcut forytm-cli. See the setup scripts above.
🎮 Controls
During Song Selection
↑/↓orj/k- Navigate through resultsEnter- Select and play songf- Add to or remove from Favoritesa- Add to a playlistq- Quit
During Playback
Space- Play/pausen- Next songp- Previous songl- Show lyrics (synced highlighting with auto-scroll)o- Toggle floating desktop lyrics (macOS with mpv)f- Add to or remove from Favoritesa- Add to playlistd- Dislike song (skip and filter from future results)q- Quit
During Lyrics View
j/kor↑/↓- Manual scrollSpace- Re-enable auto-scrollqorEsc- Back to playerPgUp/PgDn- Page scrollHome/End- Jump to top/bottom
macOS Desktop Lyrics
Press o in the terminal player to show or hide a floating, click-through lyrics panel above other apps. By default, it shows only the current lyric at the top center of the display, below the menu bar, without stealing keyboard focus or interrupting playback. Both Rich and curses playback support it; l still opens the terminal lyrics viewer.
- Requires mpv playback and Apple Command Line Tools (
xcode-select --installif missing). - The small native AppKit helper compiles in the background on first use and is cached in
~/Library/Caches/ytm-cli/. No extra Python dependencies or Accessibility permission are needed. - Lyrics follow mpv's playback position, including pause and seek, and refresh automatically when the track changes.
- Songs with only plain lyrics or no matching synced lyrics show “No synced lyrics available” for 3 seconds, then fade out over 0.4 seconds; no timing is invented. Normal synced lyrics stay visible.
- The overlay starts off each session and closes when playback exits.
ois a terminal shortcut, not a system-wide hotkey. - The window is configured to join Spaces and fullscreen spaces, but visibility above other apps' fullscreen windows depends on macOS window management.
To also preview the next lyric, add this setting under [ui] in ~/.config/ytm-cli/config.ini, then restart playback:
[ui]
lyrics_overlay_show_next_line = true
The default is false (current lyric only). This controls lyric entries, not text wrapping: a long current lyric can still wrap for readability.
📋 Playlist Management
Create and manage playlists:
ytm-cli playlist list # List all playlists
ytm-cli playlist create # Create new playlist
ytm-cli playlist show "My Songs" # View playlist contents
ytm-cli playlist play "My Songs" # Play entire playlist
ytm-cli playlist delete "My Songs" # Delete playlist
Add songs to playlists:
- Press
aduring song selection or playback - Choose existing playlist or create new one
- Song added without interrupting playback
Favorite songs:
- Press
fduring song selection or playback to toggle a favorite - The local
Favoritesplaylist is created automatically on first use - Play favorites with
ytm-cli playlist play Favorites - Favoriting a song clears its global dislike; globally disliking a song removes it from Favorites
- During local playlist playback,
dfirst removes the song from that playlist; press it again to globally dislike and skip the song
🤖 AI Music Assistant
Use natural language to search and create playlists powered by AI (supports Google Gemini, OpenAI, Anthropic):
ytm-cli llm ask "play something chill for studying" # AI picks and auto-plays
ytm-cli llm ask "upbeat pop songs for a workout" # Natural language search
ytm-cli llm playlist "lo-fi beats for rainy days" --play # AI-generated playlist
ytm-cli llm playlist "90s rock classics" -n 20 # 20-song playlist
Configure your provider in config.ini:
[llm]
provider = google # google, openai, or anthropic
model = gemini-2.5-pro
🛠️ Configuration
The app uses config.ini for customization:
[general]
songs_to_display = 10
show_thumbnails = true
[mpv]
# Add custom mpv flags
flags = --no-video
[playlists]
directory = playlists
🎯 Philosophy
Keep it simple for the listener to enjoy music. Features are designed to be:
- Intuitive: Single-key shortcuts during playback
- Non-disruptive: Actions don't interrupt your listening experience
- Consistent: Same navigation patterns across all screens
- Quick: Important features accessible with simple key presses
🐛 Troubleshooting
Having issues? Check out the Troubleshooting Guide for solutions to common problems:
Quick diagnosis:
# Enable verbose logging to see what's happening
ytm-cli search "test" -s 1 --verbose --log-file debug.log
# Check versions
mpv --version
yt-dlp --version
📄 License
This project is open source. Please check the license file for details.
Enjoy your music! 🎵
Metadata
Release files for ytm-cli 0.12.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ytm_cli-0.12.0.tar.gz | 106.9 kB | With provenance | Details for ytm_cli-0.12.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ytm_cli-0.12.0-py3-none-any.whl | Python 3 | none | any | Details for ytm_cli-0.12.0-py3-none-any.whl |
Total release size: 178.9 kB
Release files / ytm_cli-0.12.0.tar.gz
| Download URL | ytm_cli-0.12.0.tar.gz |
|---|---|
| Size | 106.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c483ac8bd4f84f0f184044aeecb90abd5d80bbb15e9d82984199ee440a3827c5
|
|
BLAKE2b-256 checksum How to use checksums |
0f46f2c92e56a2012a1a3967fdd12d6ac0699d690ad124173b1ea2f1e3cc8d72
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 8, 2026.
Transparency logRelease files / ytm_cli-0.12.0-py3-none-any.whl
| Download URL | ytm_cli-0.12.0-py3-none-any.whl |
|---|---|
| Size | 72.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ebd1c1f8a6fb51b88ee31640ce3fff605891c2c6c125d7f20eb8484dd4200a54
|
|
BLAKE2b-256 checksum How to use checksums |
dc2c0018ac6bcaba56ff9b20a1897df5a2ea5fd72f20d5e63d8fc528069e2019
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 8, 2026.
Transparency logSecurity for ytm-cli 0.12.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for ytm_cli-0.12.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 8, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.