Apple Music CLI
Use clawtunes to control Apple Music from the terminal. Search and play music, control playback, adjust volume, manage playlists, manage shuffle/repeat, browse the Apple Music catalog, and connect to AirPlay devices.
Setup
- - Install (Homebrew): INLINECODE1
- macOS-only; requires Apple Music app.
Play Music
- - Play a song: INLINECODE2
- Play an album: INLINECODE3
- Play a playlist: INLINECODE4
- Always use the
--non-interactive (-N) flag to prevent interactive prompts: INLINECODE7 - If the command exits with code 1 and lists multiple matches, retry with a more specific song/album/playlist name.
- If a more specific name still returns multiple matches, use the
--first (-1) flag to auto-select the first result: INLINECODE10
Playback Control
- - Pause: INLINECODE11
- Resume: INLINECODE12
- Next track: INLINECODE13
- Previous track: INLINECODE14
- Show now playing: INLINECODE15
Volume
- - Show volume: INLINECODE16
- Set volume: INLINECODE17
- Adjust volume:
clawtunes volume +10 or INLINECODE19 - Mute: INLINECODE20
- Unmute: INLINECODE21
Shuffle and Repeat
- - Enable/disable shuffle:
clawtunes shuffle on or INLINECODE23 - Set repeat mode:
clawtunes repeat off, clawtunes repeat all, or INLINECODE26
Search
- - Search songs and albums: INLINECODE27
- Include playlists: INLINECODE28
- Songs only: INLINECODE29
- Limit results: INLINECODE30
Love/Dislike
- - Love current track: INLINECODE31
- Dislike current track: INLINECODE32
Playlists
- - List all playlists: INLINECODE33
- Create a playlist: INLINECODE34
- Add a song to a playlist: INLINECODE35
- Remove a song from a playlist: INLINECODE36
AirPlay
- - List devices: INLINECODE37
- Select device: INLINECODE38
- Deselect device: INLINECODE39
Apple Music Catalog
- - Search the streaming catalog: INLINECODE40
- Limit catalog results: INLINECODE41
- Note: Catalog search is browse-only. To add songs to playlists, they must first be in your library. Use Apple Music app to add catalog items to your library before managing them with clawtunes.
Notes
- - macOS-only (uses AppleScript to communicate with Apple Music).
- If automation permissions are requested, grant access in System Settings > Privacy & Security > Automation.
Apple Music CLI
使用 clawtunes 从终端控制 Apple Music。搜索和播放音乐、控制播放、调整音量、管理播放列表、管理随机播放/重复模式、浏览 Apple Music 目录以及连接 AirPlay 设备。
设置
- - 安装(Homebrew):brew install forketyfork/tap/clawtunes
- 仅限 macOS;需要 Apple Music 应用。
播放音乐
- - 播放歌曲:clawtunes play song 歌曲名称
- 播放专辑:clawtunes play album 专辑名称
- 播放播放列表:clawtunes play playlist 播放列表名称
- 始终使用 --non-interactive(-N)标志以防止交互式提示:clawtunes -N play song 歌曲名称
- 如果命令退出代码为 1 并列出多个匹配项,请使用更具体的歌曲/专辑/播放列表名称重试。
- 如果更具体的名称仍返回多个匹配项,请使用 --first(-1)标志自动选择第一个结果:clawtunes -1 play song 歌曲名称
播放控制
- - 暂停:clawtunes pause
- 恢复播放:clawtunes resume
- 下一曲:clawtunes next
- 上一曲:clawtunes prev
- 显示当前播放:clawtunes status
音量
- - 显示音量:clawtunes volume
- 设置音量:clawtunes volume 50
- 调整音量:clawtunes volume +10 或 clawtunes volume -10
- 静音:clawtunes mute
- 取消静音:clawtunes unmute
随机播放和重复
- - 启用/禁用随机播放:clawtunes shuffle on 或 clawtunes shuffle off
- 设置重复模式:clawtunes repeat off、clawtunes repeat all 或 clawtunes repeat one
搜索
- - 搜索歌曲和专辑:clawtunes search 查询内容
- 包含播放列表:clawtunes search 查询内容 -p
- 仅搜索歌曲:clawtunes search 查询内容 --no-albums
- 限制结果数量:clawtunes search 查询内容 -n 20
喜欢/不喜欢
- - 喜欢当前曲目:clawtunes love
- 不喜欢当前曲目:clawtunes dislike
播放列表
- - 列出所有播放列表:clawtunes playlists
- 创建播放列表:clawtunes playlist create 公路旅行
- 将歌曲添加到播放列表:clawtunes playlist add 公路旅行 Kickstart My Heart
- 从播放列表中移除歌曲:clawtunes playlist remove 公路旅行 Kickstart My Heart
AirPlay
- - 列出设备:clawtunes airplay
- 选择设备:clawtunes airplay 设备名称
- 取消选择设备:clawtunes airplay 设备名称 --off
Apple Music 目录
- - 搜索流媒体目录:clawtunes catalog search Bowie Heroes
- 限制目录搜索结果:clawtunes catalog search Bowie Heroes -n 5
- 注意:目录搜索仅为浏览功能。要将歌曲添加到播放列表,它们必须首先存在于您的资料库中。请先使用 Apple Music 应用将目录项目添加到您的资料库,然后再使用 clawtunes 进行管理。
注意事项
- - 仅限 macOS(使用 AppleScript 与 Apple Music 通信)。
- 如果请求自动化权限,请在系统设置 > 隐私与安全性 > 自动化中授予访问权限。