MacOS – Strictly limit macOS Photos library size using “Optimize Storage”

icloudmacosphotos

I want to use the Photos.app option "Optimize Mac Storage" to free up space on my Mac, rather than downloading my entire iCloud Photos Library to my small laptop SSD.

Is there any way to strictly limit the space given to the Photos library?

I want to give, say, 40 GB to Photos. The app can "optimize" that space as it sees fit, but I never want it to take more than 40 GB.

iCloud Photos > Optimize Mac Storage

If your Mac is low on space, full-resolution photos and videos are automatically replaced with smaller, device-sized versions. Full-resolution versions can be downloaded from iCloud anytime.

Best Answer

Limiting Photos iCloud Photos Library sizes was discussed on Accidental Tech Podcast:

https://atp.fm/334 (1:36:45)
https://atp.fm/335 (0:04:20)
https://atp.fm/410 (2:19:05)

They originally suggested using a Sparse Disk Image with a size quota.

Follow-up suggested instead using an APFS Space-Sharing volume.

Hey, others may have said this, but don’t use a sparse image for your photo library. Add an APFS volume with a 30GB quota instead. Much, much safer! (twitter)


APFS Space-Sharing Volume

In Disk Utility, select Add APFS Volume..

APFS volumes share storage space within their container.

Add APFS volume to container

Set a Quota Size to strictly limit the size of the new volume:

Size Options

APFS Volumes share storage space within their container. The optional reserve size ensures that amount of storage will remain available for this volume. The optional quota size limits how much storage this volume can allocate.

Set a Quota Size

When you move your Photos library, your iCloud photos will only be permitted to fill this Quota Size set for the volume.


Move Photos Library

Finally, move your Photos library file to the new size-limited volume.

Quit Photos.app > Move the library file > Hold Option and relaunch Photos > Pick the library’s new location > Photos Preferences > Use as System Photo Library

How to put Photos.app main library on an external disk?

Or, start a new Photos library on the volume and allow iCloud to re-download your photos.