Play/Pause Music from the Terminal
Toggle playback in the Music app with a one-line AppleScript.
Run `osascript -e 'tell application "Music" to playpause'` to toggle play/pause.
01Command
Command
$ osascript -e 'tell application "Music" to playpause'02What it does
playpause flips between playing and paused, so the same line works as a remote-control toggle — handy in shell scripts, SSH sessions, or when the media keys are being captured by another app. Other useful verbs are `play`, `pause`, `next track`, and `previous track`. The Music app launches in the background if it isn't already running.
03Risk
!Warning: This controls the Apple Music app only — Spotify and browser players need their own AppleScript or media-key commands.
04Undo
✓No undo needed — this command does not change persistent state.
05Sources
- osascript — execute AppleScript and OSA scripts (macOS man page)Evidence: Documents running AppleScript one-liners with -e, such as telling the Music application to perform commands.
Last verified: 2026-09-18 · Category: Media