From NixOS Wiki
Jump to: navigation, search

The Media Transfer Protocol (MTP) can be used to transfer media files to and from many mobile phones (most Windows Phone and Android devices) and media players (e.g. Creative Zen).

MTP devices are usually mounted via FUSE and then appear as a more or less regular file system.

This page lists some ways to mount a MTP device.


Install jmtpfs:

$ nix-env -f "<nixpkgs>" -iA jmtpfs

To mount the only available device:

$ mkdir mountpoint
$ jmtpfs mountpoint

If there are several connected devices, use -l to find them and -device= to specify which one to mount.

To unmount:

$ fusermount -u


On NixOS, file managers that support gvfs, such as PCManFM, can mount mtp devices by adding this to configuration.nix:

  services.gvfs.enable = true;

The above should suffice, but there also exists a more manual method. This method apparently only works well with gtk/gnome-based desktops like Gnome Shell or Xfce. It relies on having gvfs listed in the environment variable GIO_EXTRA_MODULES, for example:


First identify your device with lsusb:

$ lsusb
Bus 002 Device 007: ID 1234:5678 The device

The adress of the device will then be mtp://[usb:002,007]/.

You need the gio from the glib package. Then:

$ gio mount "mtp://[usb:002,007]/"

to mount and

$ gio mount -u "mtp://[usb:002,007]/"

to unmount.

The device will appear in your favorite file manager.