How to Download iCloud Photos via the Command Line

Aug 2, 2022 - 6 Comments

Download iCloud Photos via Command Line

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

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 installed Python 3.x or installed Homebrew on the Mac if you haven’t done so already. We’re going to assume you’re using Homebrew on a Mac, but if you’re using something else then go with the appropriate install method instead.

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

brew install python

Once python is finished installing, you can install icloud_photos_downloader package with pip using the following command:

pip install icloudpd

When finished installing icloudpd, you’re ready to go.

How to Download All iCloud Photos via Command Line

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

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

icloudpd --directory ~/iCloudPhotoBackup \
--username \
--password examplepassword123 \

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

Make sure you have sufficient disk space available to complete the download, and make sure you have the bandwidth available as well. A lot of photos can take a very long time to download, so if you have a library of 100,000+ pictures taking up 350GB of storage space, have patience and let the whole thing complete.

When finished you’ll want to review the directory you downloaded everything to so that you know

There are other ways to download all photos from iCloud, including downloading them all from iCloud on by the Mac by turning off iCloud Photos feature, performing a similar action to download them all from iCloud to an iPhone or iPad, using the website download feature (which unfortunately limits to 1000 photos at a time, making it impractical for users with large photos libraries), or using the ‘Download Originals’ setting for iCloud Photos in Photos on the Mac (again be sure you have sufficient disk space to achieve this), or you can even use the GDPR data request tool from Apple to request a copy of all the stuff Apple has from you – including iCloud Photos.

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

Usage: options

Download all iCloud photos to a local directory

-d, --directory directory Local directory that should be used for
-u, --username username Your iCloud username or email address
-p, --password password Your iCloud password (default: use PyiCloud
keyring or prompt for password)
--cookie-directory /cookie/directory
Directory to store cookies for
authentication (default: ~/.pyicloud)
--size [original|medium|thumb] Image size to download (default: original)
--live-photo-size [original|medium|thumb]
Live Photo video size to download (default:
--recent INTEGER RANGE Number of recent photos to download
(default: download all photos)
--until-found INTEGER RANGE Download most recently added photos until we
find x number of previously downloaded
consecutive photos (default: download all
-a, --album album Album to download (default: All Photos)
-l, --list-albums Lists the avaliable albums
--skip-videos Don't download any videos (default: Download
all photos and videos)
--skip-live-photos Don't download any live photos (default:
Download live photos)
--force-size Only download the requested size (default:
download original if size is not available)
--auto-delete Scans the "Recently Deleted" folder and
deletes any files found in there. (If you
restore the photo in iCloud, it will be
downloaded again.)
--only-print-filenames Only prints the filenames of all files that
will be downloaded (not including files that
are already downloaded.)(Does not download
or delete any files.)
--folder-structure folder_structure
Folder structure (default: {:%Y/%m/%d})
--set-exif-datetime Write the DateTimeOriginal exif tag from
file creation date, if it doesn't exist.
--smtp-username smtp_username
Your SMTP username, for sending email
notifications when two-step authentication
--smtp-password smtp_password
Your SMTP password, for sending email
notifications when two-step authentication
--smtp-host smtp_host Your SMTP server host. Defaults to:
--smtp-port smtp_port Your SMTP server port. Default: 587 (Gmail)
--smtp-no-tls Pass this flag to disable TLS for SMTP (TLS
is required for Gmail)
--notification-email notification_email
Email address where you would like to
receive email notifications. Default: SMTP
--notification-script PATH Runs an external script when two factor
authentication expires. (path required:
--log-level [debug|info|error] Log level (default: debug)
--no-progress-bar Disables the one-line progress bar and
prints log messages on separate lines
(Progress bar is disabled by default if
there is no tty attached)
--threads-num INTEGER RANGE Number of cpu threads (default: 1)
--version Show the version and exit.
-h, --help Show this message and exit.

As you can see there are quite a few customizable options available, likely beyond the needs of most users who simply want to download all their photos from iCloud to a local device or storage for backup purposes, archiving, or whatever else.

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


Related articles:

Posted by: Paul Horowitz in Command Line, Tips & Tricks


» Comments RSS Feed

  1. Michael says:

    It works, but couldn’t download everything to a single directory (without sub-directories).

    • Pal says:

      What did your subdirectories become labeled as? And how many photos / how large of an iCloud Library did you have?

      You can always flatten the directory structure after and get all the pics into a single folder, also using the command line.

    • MJ says:

      It will download everything to a single directory if you add the –folder-structure {:%Y} flag.

  2. DJ MacIntosh says:

    This looks like a wonderful tool. I haven’t been able to get it to work yet. I keep getting this error “iCloud Photo Library not finished indexing. Please try again in a few minutes”.

  3. Haruna Hamisu says:

    Can this be done on mobile too?

Leave a Reply


Shop on and help support OSXDaily!

Subscribe to OSXDaily

Subscribe to RSS Subscribe to Twitter Feed Follow on Facebook Subscribe to eMail Updates

Tips & Tricks


iPhone / iPad



Shop on Amazon to help support this site