Backup iOS device on Linux easily

Even though officially iTunes isn’t available on Linux to help with iOS devices, it’s actually pretty simple to backup.
All you need is libimobiledevice.

Install it with: sudo apt install usbmuxd libimobiledevice6 libimobiledevice-utils

First we need to configure encryption. iOS won’t let you backup everything without encrypting the backup.
Type idevicebackup2 encryption on, and then authorize it with your phone’s password.

Once that’s done, we can backup. It’s as simple as running idevicebackup2 backup /path/to/backup

I made a tiny helper script to help you automate that, with a clear year/month/day path and provides a simple gui way (click the script file from file manager)

#!/bin/bash

# https://askubuntu.com/questions/661870/bash-script-doesnt-run-from-nautilus-but-does-run-from-terminal
run_in_terminal() {
    # run in a new terminal if not already
    if [ ! "${RUNNING_IN_TERMINAL:-}" -a ! -t 1 -a "${DISPLAY:-}" ]; then
        RUNNING_IN_TERMINAL=1 exec x-terminal-emulator -e "[email protected]"
    fi

    # wait for prompt to close the terminal
    if [ "${RUNNING_IN_TERMINAL:-}" ]; then
        exit_prompt() {
            echo
            read -p "Finished.  Press any key to close..." -n 1
        }
        trap exit_prompt EXIT 
    fi
}

run_in_terminal "$0" "[email protected]"

cdate=$(date +"%Y/%m/%d")
mkdir -p ./$cdate
read -p "Are you sure you wish to continue? (yes/no)"
if [ "$REPLY" != "yes" ]; then
   exit
fi
idevicebackup2 backup $(pwd)/$cdate

Just make sure the script is executable, and have the file manager set to ask you if you want to run it in preferences.

Leave a comment

Your email address will not be published. Required fields are marked *