Copying photos out of an iPhone another device is not trivial. The approach suggested by Apple seems to be to copy your photos onto their servers, but actually downloading them is a pain. You can either download them one at a time, or request request a takeout, which takes about a week. A ridiculous approach when you want to move files from one device to another that’s 30cm away.
In my experience, the simplest approach (which is not at all simple) to copying
photos seems to be using usbmuxd
with ifuse
. These set of tools allow
mounting the phone onto the local file system, and moving the regular photo
files out.
When using usbmuxd
, please keep in mind that all users on your target host
have complete access to the iOS device. Even on a single-user system,
this means non-interactive accounts like those used by background system
services have access, including the user nobody
.
The latest release of usbmuxd
happened in 2020, and doesn’t work with recent
devices or recent versions of iOS. You’ll need to rebuild from source. All build
dependencies can be installed with:
doas apk add -t .usbmuxd-dev \
automake \
autoconf \
libtool \
libusb-dev \
libplist-dev \
libimobiledevice-dev \
libimobiledevice-glue-dev
Then, clone the source repository and build it as indicated in the instructions:
git clone https://github.com/libimobiledevice/usbmuxd.git
cd usbmuxd
./autogen.sh
make
doas make install
usbmuxd
has some magic mechanism to automatically run when a device is plugged
in, but it is quick hacky and unreliable. Simply run the daemon manually:
doas usbmuxd --foreground
Now plug the iOS device with a USB cable, and mount the iPhone’s filesystem:
mkdir -p ~/mount/iphone
ifuse ~/mount/iphone
Note that ifuse
forks to the background immediately, so while it seems that it
may have exited, it’s still running.
Photos and videos will be available under ~/mount/iphone/DCIM
. They can be
moved around as regular files.
When moving photos out of the phone, the Photos app will still show them as present. This is because the Photos app keeps its own database of photos. A workaround for this issue is to delete the Photo app’s database. It will then re-create a new empty database, and show no photos.
To delete the Photo app’s database, use:
cd ~/mount/iphone/PhotoData
rm Photos.sqlite Photos.sqlite-shm Photos.sqlite-wal
Note that Albums and favourites are generally lost during this process. This information is also lost when moving the photos out, so I don’t bother with organising photos on-device at all.
Finally, I use this quick and dirty script to sort photos into directories by date taken. Do not run this script in a directory with existing subdirectories; it may overwrite data inside of them.
Note that screenshots don’t have date and time metadata, so this also filters them out rather quickly (I personally don’t store screenshots with my “real” photos).