Skip to main content

Comprehensive Apple TV CLI & TUI remote control powered by pyatv

Project description

๐ŸŽ pyatv-cli

The ultimate Apple TV remote control for your terminal

50+ commands ยท Full-screen TUI ยท Rich output ยท JSON scripting

PyPI Python License Downloads


Control your Apple TV entirely from the terminal. Power, remote, media, apps, audio, streaming, touch gestures โ€” everything your Siri Remote can do, atv can do better. Built on pyatv with gorgeous Rich output and a full-screen Textual TUI.


๐Ÿ“– Table of Contents


โœจ Feature Highlights

  • ๐ŸŽฎ 50+ commands across 13 command groups โ€” power, remote, media, apps, audio, keyboard, touch, stream, system, accounts, monitor, settings, shell
  • ๐Ÿ–ฅ๏ธ Full-screen TUI โ€” A beautiful Textual-based terminal UI with live-updating now-playing, volume control, and remote buttons
  • ๐Ÿ” Auto-discovery โ€” Find every Apple TV on your network with one command
  • ๐Ÿ”— Interactive pairing โ€” Guided PIN-based pairing flow, credentials saved automatically
  • ๐Ÿ“Š Rich terminal output โ€” Beautiful tables, panels, and formatted text via Rich
  • ๐Ÿค– JSON mode โ€” Pipe --json output to jq for scripting and automation
  • ๐Ÿ“บ Real-time monitor โ€” Live-updating now-playing display with Rich Live
  • ๐Ÿš Interactive shell โ€” REPL mode for rapid-fire commands
  • ๐ŸŒ AirPlay streaming โ€” Stream URLs and local files to your TV
  • ๐Ÿ‘† Touch gestures โ€” Swipes, taps, double-taps, and long presses
  • โŒจ๏ธ Virtual keyboard โ€” Type text directly into Apple TV search fields
  • ๐Ÿ’พ Multi-device support โ€” Pair and switch between multiple Apple TVs
  • ๐Ÿ Python 3.10โ€“3.14 โ€” Runs on modern Python with zero configuration

๐Ÿค” Why pyatv-cli?

If you've used atvremote (the built-in CLI from pyatv), you'll appreciate what pyatv-cli brings to the table:

Feature atvremote pyatv-cli
Beautiful Rich output โŒ โœ…
Full-screen TUI โŒ โœ…
Credential persistence โŒ โœ…
Multi-device management โŒ โœ…
JSON output for scripting โŒ โœ…
Interactive shell (REPL) โŒ โœ…
Touch gesture commands โŒ โœ…
Organized command groups โŒ โœ…
One-word atv command โŒ โœ…

๐Ÿ‘€ Preview

Scan Output

$ atv scan
โ„น Scanning for Apple TVs (timeout: 5s)...

                  ๐ŸŽ Discovered Apple TVs
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Name             โ”‚ Address       โ”‚ Model    โ”‚ Services     โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ Living Room      โ”‚ 192.168.1.50  โ”‚ AppleTV4Kโ”‚ MRP, AirPlay โ”‚
โ”‚ Bedroom TV       โ”‚ 192.168.1.51  โ”‚ AppleTV4Kโ”‚ MRP, AirPlay โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Found 2 device(s). Use atv pair to pair.

Now Playing

$ atv media info
โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ ๐ŸŽต Now Playing โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚  Title:     Bohemian Rhapsody                    โ”‚
โ”‚  Artist:    Queen                                โ”‚
โ”‚  Album:     A Night at the Opera                 โ”‚
โ”‚  State:     โ–ถ๏ธ  Playing                           โ”‚
โ”‚  Position:  2:31 / 5:55                          โ”‚
โ”‚  App:       Apple Music                          โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

TUI Mode

$ atv tui
โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ ๐ŸŽ Apple TV Remote โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚                                                          โ”‚
โ”‚  ๐ŸŽต Bohemian Rhapsody              โ–ถ๏ธ  Playing            โ”‚
โ”‚  ๐ŸŽค Queen                                                โ”‚
โ”‚  ๐Ÿ’ฟ A Night at the Opera                                 โ”‚
โ”‚  โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘  2:31 / 5:55                โ”‚
โ”‚                                                          โ”‚
โ”‚          โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”                                        โ”‚
โ”‚          โ”‚  โ–ฒ   โ”‚                                        โ”‚
โ”‚     โ”Œโ”€โ”€โ”€โ”€โ”ค  OK  โ”œโ”€โ”€โ”€โ”€โ”                                   โ”‚
โ”‚     โ”‚ โ—€  โ”‚      โ”‚ โ–ถ  โ”‚                                   โ”‚
โ”‚     โ””โ”€โ”€โ”€โ”€โ”ค  โ–ผ   โ”œโ”€โ”€โ”€โ”€โ”˜                                   โ”‚
โ”‚          โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”˜                                        โ”‚
โ”‚                                                          โ”‚
โ”‚  [โฎ] [โช] [โฏ] [โฉ] [โญ]     ๐Ÿ”ˆ โ”โ”โ”โ”โ”โ”โ”โ”โ”โ–‘โ–‘โ–‘ 72%       โ”‚
โ”‚                                                          โ”‚
โ•ฐโ”€โ”€โ”€ q:Quit  Space:Play/Pause  h:Home  Esc:Menu โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

๐Ÿ“ฆ Installation

Recommended: pipx (one command, works everywhere)

# If you don't have pipx yet:
brew install pipx && pipx ensurepath   # macOS
# sudo apt install pipx && pipx ensurepath  # Linux

# Install pyatv-cli globally:
pipx install pyatv-cli

Why pipx? It installs CLI apps in isolated environments โ€” no dependency conflicts, no externally-managed-environment errors, no sudo. Just works. Learn more โ†’

One-liner (macOS)

brew install pipx && pipx ensurepath && pipx install pyatv-cli

Alternative: pip with virtual environment

python3 -m venv ~/.venvs/atv && source ~/.venvs/atv/bin/activate && pip install pyatv-cli

From source (for development)

git clone https://github.com/yigitkonur/pyatv-cli.git
cd pyatv-cli
pip install -e .

Requires Python 3.10+. Dependencies (pyatv, click, rich, textual) are installed automatically.


๐Ÿš€ Quick Start

Get up and running in three steps:

1๏ธโƒฃ Discover Apple TVs on your network

atv scan

2๏ธโƒฃ Pair with your Apple TV

atv pair
# A PIN will appear on your TV โ€” enter it when prompted

3๏ธโƒฃ Start controlling!

# Check power state
atv power status

# Play / pause
atv remote play-pause

# See what's playing
atv media info

# Launch an app
atv apps launch com.apple.TVMusic

# Open the full TUI
atv tui

๐Ÿ“š Complete Command Reference

๐Ÿ” Discovery & Setup

Command Description
atv scan Discover Apple TVs on your network
atv scan --host 192.168.1.50 Scan a specific IP address
atv scan --timeout 10 Custom scan timeout (default: 5s)
atv pair Pair with an Apple TV (interactive PIN flow)
atv pair --protocol airplay Pair using a specific protocol
atv unpair --protocol companion Remove credentials for a protocol
atv unpair --all Remove device entirely
atv devices List all paired devices
atv default <id> Set the default device
atv default Show current default device

โšก Power Control

Command Description
atv power status Show current power state
atv power on Turn on
atv power off Turn off
atv power toggle Toggle power state

๐ŸŽฎ Remote Control

Full Siri Remote emulation with 27 commands:

Command Description
atv remote up Navigate up
atv remote down Navigate down
atv remote left Navigate left
atv remote right Navigate right
atv remote select Confirm selection (OK)
atv remote menu Menu / Back
atv remote home Home button
atv remote home-hold Long-press Home
atv remote top-menu Top menu
atv remote play Play
atv remote pause Pause
atv remote stop Stop
atv remote play-pause Toggle play/pause
atv remote next Next track
atv remote previous Previous track
atv remote skip-forward Skip forward
atv remote skip-backward Skip backward
atv remote volume-up Volume up
atv remote volume-down Volume down
atv remote channel-up Channel up
atv remote channel-down Channel down
atv remote screensaver Activate screensaver
atv remote guide Open guide
atv remote control-center Open Control Center
atv remote set-position <sec> Seek to position (seconds)
atv remote set-shuffle off|songs|albums Set shuffle mode
atv remote set-repeat off|track|all Set repeat mode

๐ŸŽต Media / Now Playing

Command Description
atv media info Show current track info (title, artist, album, state, position)
atv media artwork -o cover.png Download current artwork to a file (-w/--width, --height to resize)

๐Ÿ“ฑ App Management

Command Description
atv apps list List installed apps (name + bundle ID)
atv apps launch <bundle_id> Launch an app by bundle identifier

๐Ÿ”Š Audio Control

Command Description
atv audio get Show current volume level
atv audio set <0-100> Set volume to a specific level
atv audio up Increase volume
atv audio down Decrease volume
atv audio devices List audio output devices

โŒจ๏ธ Virtual Keyboard

Command Description
atv keyboard status Check if keyboard is focused
atv keyboard get Get current text in the field
atv keyboard set <text> Replace text in the field
atv keyboard append <text> Append text to the field
atv keyboard clear Clear the text field

๐Ÿ‘† Touch Gestures

Command Description
atv touch swipe up|down|left|right Directional swipe gesture
atv touch swipe-custom <x1> <y1> <x2> <y2> Custom swipe between coordinates
atv touch tap Single tap
atv touch double-tap Double tap
atv touch hold Long press

๐ŸŒ Streaming

Command Description
atv stream url <url> Stream media from a URL
atv stream file <path> Stream a local file via AirPlay

๐Ÿ’ป System Information

Command Description
atv system info Show device info (model, OS, version)
atv system features List supported features with status table

๐Ÿ‘ค User Accounts

Command Description
atv accounts list List user accounts on the device
atv accounts switch <id> Switch to a different account

๐Ÿ“Š Live Monitoring

Command Description
atv monitor Real-time now-playing display with Rich Live (Ctrl+C to stop)

โš™๏ธ Settings

Command Description
atv settings show Show current configuration
atv settings set <key> <value> Change a setting
atv settings remove <key> Remove a setting

๐Ÿš Interactive Shell

Command Description
atv shell Launch interactive REPL for rapid-fire commands

๐ŸŒ Global Options

Option Description
--json Output in JSON format for scripting and piping
--version Show version number

Note: --device <id> and --host <ip> are not global options โ€” they are available on most subcommands to target a specific paired device or connect by IP address.


๐Ÿ–ฅ๏ธ TUI Mode

Launch a full-screen interactive terminal UI to control your Apple TV:

atv tui

The TUI provides:

  • ๐ŸŽต Live now-playing panel โ€” Title, artist, album, progress bar updated in real-time
  • ๐ŸŽฎ Visual remote control โ€” On-screen directional pad and media buttons
  • ๐Ÿ”Š Volume control โ€” Real-time volume indicator
  • ๐Ÿ“ฑ App info โ€” See which app is currently running
  • ๐ŸŽจ Dark/light theme โ€” Toggle with d

โŒจ๏ธ Keyboard Shortcuts

Key Action
โ†‘ โ†“ โ† โ†’ Navigate
Enter Select / OK
Space Play / Pause
Esc or m Menu / Back
h Home
n Next track
p Previous track
] Volume up
[ Volume down
d Toggle dark/light theme
q Quit TUI

๐Ÿ”ง JSON Scripting

Every command supports --json for easy scripting and automation:

# Get all device names on your network
atv --json scan | jq '.[].name'

# Get the currently playing song title
atv --json media info | jq -r '.Title'

# Get volume as a number
atv --json audio get | jq '.volume'

# List all app bundle IDs
atv --json apps list | jq '.[].identifier'

# Check if the TV is on
atv --json power status | jq -r '.power_state'

Automation Examples

# Turn off TV at midnight (cron)
0 0 * * * /usr/local/bin/atv power off

# Play/pause from a Stream Deck or shortcut
atv remote play-pause

# Build a dashboard with watch
watch -n 2 'atv --json media info | jq "{title: .Title, artist: .Artist, state: .State}"'

# Notify when song changes (macOS)
while true; do
  TITLE=$(atv --json media info | jq -r '.Title // empty')
  [ -n "$TITLE" ] && osascript -e "display notification \"$TITLE\" with title \"Now Playing\""
  sleep 10
done

โš™๏ธ Configuration

Config File Location

Credentials and device settings are persisted at:

~/.config/pyatv-cli/config.json

Config Structure

{
  "default_device": "AA:BB:CC:DD:EE:FF",
  "devices": {
    "AA:BB:CC:DD:EE:FF": {
      "name": "Living Room",
      "address": "192.168.1.50",
      "identifier": "AA:BB:CC:DD:EE:FF",
      "credentials": {
        "companion": "...",
        "airplay": "..."
      }
    }
  }
}

Multi-Device Support

# Pair multiple devices
atv pair --host 192.168.1.50
atv pair --host 192.168.1.51

# Switch default device
atv default <device-id>

# Target a specific device for one command
atv --device <device-id> power on
atv --host 192.168.1.51 remote play

๐Ÿ“ก Protocol Support

pyatv-cli supports all four Apple TV protocols via pyatv:

Protocol What It Unlocks
Companion Remote control commands, app launching, power management, keyboard input โ€” the primary protocol for tvOS control
AirPlay Media streaming (URLs, local files), artwork, audio routing
MRP (Media Remote Protocol) Now-playing info, playback control, volume, media metadata
RAOP (Remote Audio Output Protocol) Audio-only streaming to AirPlay speakers and Apple TVs

Pairing by Protocol

# Pair Companion (recommended first)
atv pair --protocol companion

# Pair AirPlay (for streaming)
atv pair --protocol airplay

# Check which protocols are paired
atv devices

Tip: Pair with Companion first โ€” it covers most commands. Add AirPlay if you need streaming.


๐Ÿ” Troubleshooting

Device not found during scan

โš  No Apple TVs found.
  • Ensure your Apple TV and computer are on the same network and subnet
  • Check that your Apple TV is powered on (not just in standby for first-time discovery)
  • Try scanning a specific IP: atv scan --host 192.168.1.50
  • Increase timeout: atv scan --timeout 15
  • Make sure multicast/mDNS traffic isn't blocked by your router or firewall

Pairing fails or PIN not appearing

  • Restart the pairing: atv pair
  • Try a different protocol: atv pair --protocol airplay
  • On your Apple TV: Settings โ†’ Remotes and Devices โ†’ Remote App and Devices โ€” ensure it's set to allow pairing
  • Restart your Apple TV and try again

"Feature unavailable" errors

  • Some features require specific protocols โ€” pair with Companion and AirPlay
  • Check supported features: atv system features
  • Certain features only work while media is actively playing

Connection drops or timeouts

  • Apple TVs can be slow to respond from standby โ€” try atv power on first
  • Ensure no other remote apps are conflicting
  • Re-pair if credentials become stale: atv unpair --all && atv pair

๐Ÿค Contributing

Contributions are welcome! Here's how:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Found a bug or have a feature request? Open an issue.


๐Ÿ“„ License

MIT License โ€” see MIT for details.


๐Ÿ™ Credits

Built on the shoulders of these excellent projects:

Project Role
pyatv Core Apple TV protocol library โ€” the engine behind everything
Click CLI framework powering all 50+ commands
Rich Beautiful terminal output โ€” tables, panels, colors
Textual Full-screen TUI framework for the interactive mode

Made with โค๏ธ by Yigit Konur

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyatv_cli-1.0.4.tar.gz (37.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyatv_cli-1.0.4-py3-none-any.whl (39.1 kB view details)

Uploaded Python 3

File details

Details for the file pyatv_cli-1.0.4.tar.gz.

File metadata

  • Download URL: pyatv_cli-1.0.4.tar.gz
  • Upload date:
  • Size: 37.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for pyatv_cli-1.0.4.tar.gz
Algorithm Hash digest
SHA256 f67237259ad0fc5359ad5473e89e89f0133a4d565286993244ed3432d6bf1fb5
MD5 326c418262aa78b61751eb8a7f89bb8c
BLAKE2b-256 56d6e0283f2693f697940e817906ee48198c6c92d429417daea3d955c2d7e728

See more details on using hashes here.

File details

Details for the file pyatv_cli-1.0.4-py3-none-any.whl.

File metadata

  • Download URL: pyatv_cli-1.0.4-py3-none-any.whl
  • Upload date:
  • Size: 39.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for pyatv_cli-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 6025d4040470e3c6b35198f54c24134d31d050ce5708d3c72afc76b5e1652d55
MD5 6aa024a3a75c8418cc3e7c99cf847946
BLAKE2b-256 527c549ba646ebbb6553109a246c499138ae9face9a40861a73dac33767f7941

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page