iOS

Related articles
Audiobook
iPhone tethering
iPod
iOS
is an operating system created by Apple Inc. for use in the iPhone series of smartphones. Although connecting iOS devices to Linux is not supported by Apple, the
libimobiledevice
project provides libraries and tools to connect and transfer data between iOS devices and Linux machines.
Tip
KDE Connect
can also be used to transfer files between iOS and Linux.
Installation
Install
the
libimobiledevice
and
usbmuxd
packages.
Connecting to a device
Usbmux daemon
usbmuxd
is responsible for performing the low-level connection to iOS devices. The
usbmuxd
package also includes an
udev
rule that automatically starts and stops the daemon whenever a device is connected or disconnected.
Connect the iOS device and verify that
usbmuxd.service
is automatically started.
$ systemctl status usbmuxd.service
...
Active: active (running) since Sun 2020-01-19 19:23:18 UTC; 22s ago
...
Pairing
After connecting your iOS device and unlocking the screen, you should be presented with a "Trust This Computer?" popup on the device. Tap "Trust", then enter your device passcode to complete the pairing process.
If you do not see the popup, you can start the pairing process manually. Connect the device, unlock the screen and run:
$ idevicepair pair
SUCCESS: Paired with device d8e8fca2dc0f896fd7cb4cb0031ba249
If you have multiple iOS devices connected
--udid
ios_udid
parameter can be passed to target specific device.
You can verify the pairing has succeeded by running:
$ idevicepair validate
SUCCESS: Validated pairing with device 00008030-001D3562367A402E
Transferring data
After pairing, iOS exposes two different filesystems to the computer. One is the media filesystem, containing the device's photos, videos and music. The second filesystem is used for sharing files directly to certain apps. This is sometimes called "iTunes document sharing".
[1]
[2]
Using a graphical file manager
File managers which use
GVFS
can interact with iOS devices. To access the media filesystem,
install
gvfs-gphoto2
. To access the app document filesystem, install
gvfs-afc
.
Note
When accessing the media filesystem, GVFS will only expose the device's photos and videos, not music.
Dolphin
support for iOS devices is included in the
kio-extras
package, which is already a dependency for Dolphin.
[3]
Manual mounting
Install
the
ifuse
package. You can then run the following command to mount your iPhone's media filesystem:
$ ifuse
mountpoint
You can use this to access the device's photos inside
mountpoint
/DCIM
.
Note
The device's music database will also be accessible in
mountpoint
/iTunes_Control
. You cannot add new songs to the device this way, but you can copy songs from the device to your computer.
Warning
Manually editing the databases inside iTunes_Control will result in their corruption, and turn your synced songs into stale data that can only be removed with a system restore.
To access an app's document filesystem, first you need to identify the app:
$ ifuse --list-apps
"CFBundleIdentifier","CFBundleVersion","CFBundleDisplayName"
"org.videolan.vlc-ios","432","VLC"
"org.wikimedia.wikipedia","1932","Wikipedia"
"org.kde.kdeconnect","2","KDE Connect"
[...]
You can then mount an application's files using:
$ ifuse --documents
APPID
mountpoint
Where
APPID
is the bundle identifier of the desired application, such as
org.videolan.vlc-ios
.
After you're done, unmount the filesystem:
$ fusermount -u
mountpoint
Importing videos and pictures
Both photos and videos can typically be found in
<mountpoint>
/DCIM/100APPLE
.
iOS tends to use formats that are not as well supported, but it can be configured to use formats with better compatibility.
[4]
Furthermore, you may wish to
convert
media that was already saved in one of the less compatible Apple formats.
Backups
Creating a backup
You can create a full backup of your iOS device using libimobiledevice by running the following command, where
backup_to
is the folder you want the backup to be placed in:
$ idevicebackup2 backup --full
backup_to
You may need to authorize the backup request on your iOS device by entering your device passcode.
Restoring a backup
A backup located in
restore_from
can be restored by running:
$ idevicebackup2 restore
restore_from
Accessing the contents of a backup
To access the contents of a backup,
idevicebackup2
provides the
info
and
unback
subcommands.
The list subcommand is broken.
However, other tools
like this one
can also be used to view and export contents of a backup.
Tip
When prompted to open the
iTunes Backup
file, open the
Manifest.db
file inside the backup folder.
Restoring
idevicerestore-git
AUR
can be used to update (reinstall the operating system without touching user data) or restore (reinstall the operating system and erase user data) iOS devices.
Troubleshooting
ifuse fails to mount application directories
When using
ifuse
to mount application directories, you may run into the following error when trying to list the contents of the mountpoint:
".": Input/output error (os error 5)
This is a
known issue
that has been fixed in the current development version of libimobiledevice, but has not been released in a stable version yet. A workaround is to install
libimobiledevice-git
AUR
.
Device cannot be redirected to a virtual machine
If you use a Windows virtual machine to sync your device via USB, trying to redirect it may fail with a "device is in use by another application" message. This is due to
usbmuxd.service
starting automatically when the device is connected. This can be solved by either
stopping or masking
usbmuxd.service
.
See also
Ubuntu documentation for iPhone and iPod Touch
(not updated since 2014)