How to Download iCloud Photos via Command Line


Ever wanted to download all photos from iCloud Photos using command line? Using the third-party tool icloud_photos_downloader, you can do that. Called icloudpd for short, it works to access and download photos directly from iCloud using the command line on a Mac, Windows or Linux PC.

icloudpd is open source, and you can check out the source project on github if interested.

Because icloud_photos_downloader is a Python tool, you will need to have Python 3.x installed or Homebrew installed on the Mac if you haven’t already. We’ll assume you’re using Homebrew on a Mac, but if you’re using something else, use the appropriate install method instead.

You’ll need to install python on the Mac first if you haven’t already. If you have installed Python before, you can skip this step.

brew install python

After the python installation is complete, you can install the icloud_photos_downloader package with pip using the following command:

pip install icloudpd

Once the icloudpd installation is complete, you are good to go.

How to Download All iCloud Photos via Command Line

Once icloudpd is installed, you are ready to use it to download photos directly from iCloud Photos using the iCloud API.

You’ll want to specify a directory to upload the photos to, and also include your Apple ID and password like this:

icloudpd --directory ~/iCloudPhotoBackup
--username [email protected]
--password examplepassword123

This will download everything photos from iCloud Photos to the destination directory.

Make sure you have enough disk space available to complete the download, and also make sure you have available bandwidth. Many photos can take a long time to upload, so if you have a library of over 100,000 photos taking up 350 GB of storage space, be patient and let it all finish.

Once done, you’ll want to revisit the directory you downloaded everything to so you know

There are other ways to download all photos from iCloud, including downloading them all from iCloud on Mac by turning off the iCloud Photos feature, performing a similar action to download them all from iCloud to iPhone or iPad, using the iCloud.com website’s upload feature (which unfortunately limits to 1000 photos at a time, making it impractical for users with large photo libraries), or using the “Upload Originals” setting to iCloud Photos in Photos on Mac (again make sure you have enough disk space for this), or you can even use the Apple’s GDPR Data Request Tool to request a copy of everything Apple has of you, including iCloud Photos.

For what it’s worth, there are many other options and flags available for icloudpd to selectively download images from iCloud Photos. If you run icloudpd –help, you will see the following options:

Usage: icloudpd.py options

Download all iCloud photos to a local directory

Option :
-d, –directory directory Local directory to use for
To download
-u, –username username Your iCloud username or email address
-p, –password password Your iCloud password (default: use PyiCloud
keyring or password request)
–cookie-directory /cookie/directory
Directory to store cookies
authentication (default: ~/.pyicloud)
–Cut [original|medium|thumb] Image size to upload (default: original)
–live-photo-size [original|medium|thumb]
Size of Live Photo video to upload (default:
original)
–recent INTEGER RANGE Number of recent photos to upload
(default: download all photos)
–until-found INTEGER RANGE Download most recently added photos until we
find x number of previous downloads
consecutive photos (default: download all
Pictures)
-a, –album album Album to download (default: All Photos)
-l, –list-albums List available albums
–skip-videos Do not download videos (default: Download
all photos and videos)
–skip-live-photos Do not upload live photos (default:
upload live photos)
–force-size Download only the requested size (default:
download the original if the size is not available)
–auto-delete Scan the “Recently Deleted” folder and
delete all files in it. (If you
restore the photo in iCloud, it will
downloaded again.)
–only-print-filenames Print only filenames of all files
will be downloaded (not counting the files that
are already downloaded.)(Do not download
or delete files.)
–folder-structure folder_structure
Folder structure (default: {:%Y/%m/%d})
–set-exif-datetime Write the DateTimeOriginal exif tag of
creation date of the file, if it does not exist.
–smtp-username smtp_username
Your SMTP username, for sending emails
notifications during two-step authentication
expired.
–smtp-password smtp_password
Your SMTP password, for sending emails
notifications during two-step authentication
expired.
–smtp-host smtp_host The host of your SMTP server. By default :
smtp.gmail.com
–smtp-port smtp_port The port of your SMTP server. Default: 587 (Gmail)
–smtp-no-tls Pass this flag to disable TLS for SMTP (TLS
is required for Gmail)
–notification-email notification_email
E-mail address to which you wish
receive email notifications. Default: SMTP
username
–notification-script PATH Execute an external script when two factors
authentication expires. (required path:
/path/to/my/script.sh)
–log-level [debug|info|error] Log level (default: debug)
–no-progress-bar Disables the one-line progress bar and
print log messages on separate lines
(The progress bar is disabled by default if
there is no ticker attached)
–threads-num INTEGER RANGE Number of cpu threads (default: 1)
–version Show version and exit.
-h, –help Display this message and exit.

As you can see, there are plenty of customizable options available, probably beyond the needs of most users who just want to download all their photos from iCloud to a local device or storage for backup, archival Or other.

Do you use icloud_photos_downloader to download all your photos from iCloud Photos? Did you use another solution? What was the size of the library you downloaded? Let us know your experiences and thoughts in the comments.

Previous How to Download and Play Google Drive Videos on iPhone
Next Can you run Windows software on a Mac M1 or M2?