Moving from Apple Photos to Immich can be challenging - especially when you want to preserve your carefully organized albums. In this guide, I'll explain how to set up an efficient pipeline that exports your photos from Apple Photos to Immich while maintaining album structure and controlling server load.
My use case for Immich is explicitely not a backup or a photos organizer. I want to keep doing all that in Apples Photos App. Immich has the sole purpose of privately sharing the pictures with family and friends. For me it's basically the iCloud replacement with "unlimited" storage.
OSXPhotos extracts the photos to a folder on my local Mac and then rsyncs that whole folder to a designated directory on the Raspberry Pi. This directory is NOT the Immich External Library directory
On the Raspberry Pi I have an external library directory setup on an external drive. In my case it's named "raw_images". The Immich_Scripts/add_albums_slowly_to_raw_images.sh script moves / copies the album directories from the designated directory to the "raw_images". This way the Raspberry Pi doesn't overload with hundreds or thousands of pictures to process. I've seen it happen which is why I'm manually slowing down this processing. I've already limited the resources for the Immich containers, and I've reduced the job concurrency to 1 job for each job category... the Pi would still freeze up after a while.
I have the raw_images folder so that if I have to re-install Immich or if something is going wrong with it, I can just spin up a blank version of it, point it to that raw_images folder and it will re-build itself. Well, I would have to slowly feed it the pictures, but they are in one place already.
I strongly recommend setting up ssh keys to access your server, but I'm sure that everyone reading this already knows.
- Mac-side export: Extract photos from Apple Photos libraries while preserving album structure
- Controlled import: Transfer files to Immich server in small batches to prevent overwhelming the system
- Automatic album creation: Convert folder structures into Immich albums
First, we need to set up the osxphotos tool which can extract photos from Apple Photos libraries.
-
Create a Python virtual environment:
python3 -m venv ~/.python_venv/osxphotos-env # I would create the virtual environment in this repository source ~/.python_venv/osxphotos-env/bin/activate python3 -m pip install osxphotos
-
Install helper scripts:
osxphotos_export_libraries.sh: Main wrapper script for exportingosxphotos_before_export.py: Handles folder name formatting before exportosxphotos_after_export.py: Cleans up folder names after export
-
Export workflow: The main script automates the process:
./osxphotos_export_libraries.sh /path/to/Photos.photoslibrary
This script:
- Exports photos organized by album structure
- Preserves metadata including album names
- Handles special characters in album names
- Filters out unwanted file types (like .orf raw files)
- Syncs the exported photos to your Immich server
-
Setup Immich: On Immich you will have to setup an external library. Read the Immich Docs on how to do that. In my case that is the raw_images folder
Get Library ID: curl -L 'https://yourimmich.example.com/api/libraries/' -H 'Accept: application/json' -H 'x-api-key:ADMIN-API-KEY'
Add this library UUID to IMMICH_LIBRARY_ID in /Immich_Scripts/add_albums_slowly_to_raw_images.sh
The add_albums_slowly_to_raw_images.sh script is the key to preventing server overload:
-
Batch processing:
- Processes photos in small batches (default 15 files)
- Monitors server CPU load before continuing
- Waits for CPU to stay below threshold before processing more files
-
Smart API integration:
- Triggers Immich library scan API calls after each batch
- Allows server to process one batch completely before starting the next
-
Duplicate prevention:
- Uses
-nflag with cp/mv to avoid processing existing files - Filters out unwanted formats (like .orf files)
- Uses
The final stage converts your folder structure to Immich albums:
-
Docker-based automation: Uses the
immich-folder-album-creatortool to convert folders to albumsdocker run \ -e SYNC_MODE="1" \ -e UNATTENDED="1" \ -e API_URL="http://server-ip:2283/api/" \ -e API_KEY="your-api-key" \ -e ROOT_PATH="/usr/src/app/external" \ salvoxia/immich-folder-album-creator:latest \ /script/immich_auto_album.sh
-
Integration:
- Automatically runs after all photos are imported
- Waits for server load to decrease before starting
-
On your Mac: Export from Apple Photos
./osxphotos_export_libraries.sh /path/to/Photos.photoslibrary
-
On your Immich server: Process the photos in batches
./add_albums_slowly_to_raw_images.sh /path/to/source_directory
-
The server script automatically:
- Processes files in small batches
- Triggers library scans after each batch
- Creates albums from folders when complete
- Preserves organization: Your album structure is maintained
- Server-friendly: Prevents overwhelming your Immich server
- Automated: Minimal manual intervention needed
- Resilient: Can be stopped/restarted without issues
- Filters: Automatically excludes unwanted file types
By following this workflow, you can migrate large Apple Photos libraries to Immich while maintaining your album organization and ensuring your server remains responsive throughout the process.