ncm-cli is the CLI tool for NetEase Cloud Music (music search, playback control, playlist management, TUI player).
Installation Process
Step 1: Install ncm-cli and mpv
1.1 Install ncm-cli
npm install -g @music163/ncm-cli
Verify installation:
ncm-cli --version
1.2 Install mpv
The playback feature requires the mpv player. First check whether it is already installed:
mpv --version
macOS / Windows: If not installed, run the installation script directly:
python3 scripts/install_mpv.py
Linux: Ask the user whether the playback feature is needed:
- If it is a desktop environment and local playback is needed → run
python3 scripts/install_mpv.py - If it is a server environment and playback is not needed → skip; commands such as search/playlist still work normally
The installation script automatically detects the package manager:
- macOS:Homebrew(
brew install mpv) or MacPorts - Linux:apt / dnf / pacman / zypper
- Windows:winget / Chocolatey / Scoop
Step 2: Configure the API Key
To use ncm-cli, you need to set the API Key first:
ncm-cli config set appId <你的AppId>
ncm-cli config set privateKey <你的PrivateKey>
If you do not have an API Key yet, please first go toNetEase Cloud Music Open Platformto apply for an API Key (appId and privateKey).
Step 3: Configure the default player
Ask the user to choose the default player:
- mpv(built-in player): lightweight, cross-platform, requires completing the mpv installation in Step 1 first
- orpheus(Cloud Music App): calls the local NetEase Cloud Music client for playback, only supported on macOS
Execute according to the user's choice:
ncm-cli config set player mpv # 选择内置播放器
ncm-cli config set player orpheus # 选择云音乐 App
Step 4: Log in
Logging in is required, please use:
ncm-cli login --background
Common Issues
| Issue | Solution |
|---|---|
ncm-cli: command not found |
Check whether the npm global bin is in PATH:npm bin -g |
mpv not found |
Re-run python3 scripts/install_mpv.py or install manually:https://mpv.io |
| Login timeout | Re-execute ncm-cli login --background |
Basic Information
- Requires Node.js >= 18