mtp-rs-cli
A universal MTP file transfer CLI built on mtp-rs.
Talk to Android phones, Kindles, Garmin watches, media players, and other MTP devices with the same handful of commands. No libmtp, no libusb, no FFI. Pure Rust.
Install
The installed binary is called mtp-rs.
Quick tour
# Show visible devices.
# Inspect a specific device and its storages.
# List files.
# Upload and download files.
# Create and remove remote objects.
# Rename, move, and copy remote objects.
# Diagnose access, storage, and common USB ownership issues.
Remote paths are POSIX-like and absolute: /, /Music/song.mp3, /GARMIN/APPS/app.prg. Device-specific workflows are just normal file operations. For example, Garmin Connect IQ sideloading is:
What you get
- One CLI, every device: phones, watches, e-readers, media players. If it speaks MTP, this works.
- JSON output with
--json: every command emits structured JSON for shell pipelines and scripts. - Stable exit codes: 0 success, 2 no device, 3 ambiguous selection, 4 access denied, 5 bad remote path, 6 transfer error, 7 verification failed.
- Streaming transfers: large uploads and downloads stream straight from disk to USB and back. No silent in-memory buffering.
--verifyfor uploads: read the file back from the device and byte-compare it against the local source.- Cross-platform: Linux, macOS, Windows.
Docs
See docs/cli.md for the full command reference: every flag, JSON schemas, exit codes, path semantics, and troubleshooting.
Platform notes
The CLI inherits the platform quirks of the underlying mtp-rs library. The big one to know about is macOS:
- macOS ships
ptpcameradwhich grabs MTP devices on connect. You may need to kill it (pkill -9 ptpcamerad) or disable it (sudo launchctl disable system/com.apple.ptpcamerad) before the CLI can open a device. - Quit
Android File Transfer.appif you have it installed. It also grabs devices on connect. - Recent macOS can deny USB access to processes started from background agents or random tool runners. If
mtp-rs deviceslists a device butinfoorgetfails, try running from Terminal or iTerm with the Mac unlocked. - On Linux, you may need udev rules. See the lib README for the snippet.
- Windows should work out of the box but is not extensively tested.
Garmin sideloading example
# Find the watch.
# Push a Connect IQ app to the watch, replace if it exists, verify after.
The CLI auto-detects Garmin watches that expose MTP as a vendor-class interface with an MTP interface string (Venu 2/2S, and likely others).
Contributing
See CONTRIBUTING.md in the repo root.
License
MIT OR Apache-2.0, at your option.