macOS & Linux tweaks, hacks, and some random thoughts

🏞 Force macOS Photos.app to download whole iCloud library

Problem

Many, many times I had issues with iCloud photos syncing. The last time I tried to save my whole Photos library (~180GB) on an external SSD drive with no luck: some originals for the latest photos were saved, while another 99% of data was still in the cloud only. What is important is that the settings were correct: I ticked ‘Download Originals to this Mac’, but this didn’t change anything.

It drove me nuts completely because I was planning to work with my new travel clip, so I needed all my photos and videos on hand, locally.

After many attempts to find a workaround, I realized that ‘smart’ algorithms mainly cause these issues, but not poor Wi-Fi/internet connection, or low bandwidth on iCloud infrastructure (ha-ha).

At the same time, I’m still not ready to use another cloud storage to save & sync my photo library. iCloud’s native look & feel and fair monthly prices are the benefits that still make me use it for a while.

Now I’m thinking about a pet project, that will allow me to force synchronization of the Photos library on my Mac using Apple Photokit. According to several forum threads, this app will be useful for many Apple users.

Solution

As for now, fortunately, I’ve finally found an easy way to download all my iCloud photos using 3rd party tool called osxphotos. This is a powerful command-line utility to work with your iCloud photos. It doesn’t have a special command like ‘store all my photos locally’, or ‘force sync all my photos with iCloud’, however, you can run an export command with specific attributes which will allow you to download all photos without actual exporting, and it works!

6 easy steps

  1. Open Terminal (search for Terminal in Spotlight or look in /Applications/Utilities)
  2. Download and install Homebrew – cool CLI package manager for Mac:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  1. Using Homebrew, download and install pipx – package manager for python:
brew install pipx
  1. Install osxphotos:
pipx install osxphotos
  1. Once completed, create temp folder:
mkdir ~/osxphotosTemp
  1. Then run export command:
osxphotos export ~/osxphotosTemp --dry-run --download-missing --use-photokit --verbose

Command explanation:
osxphotos export – run export command. In our case we don’t need to perform actual export, that’s why we also adding --dry-run param
~/osxphotosTemp – we need to specify some folder for ‘export’. It’ll stay empty, since --dry-run param is provided
--dry-run – tell osxphotos to simulate the export process without actual exporting. Despite this, originals will still be downloaded from iCloud
--download-missing – our key to solving the issue – all missing photos and videos will be downloaded from iCloud servers
--use-photokit – Apple’s Photokit will be used
--verbose – make osxphotos display sync details

ℹ️ If you have a very large photo library, something could go wrong during command execution. You can re-run the command again and again until the whole library will be synced to your Mac.