Is there someway to get a list of all missing photos from the photo library?
Short answer: you can use the script in this GitHub repo.
Long answer:
I had the same question, and it turns out that the photo library is backed by a SQLite database under the covers. On your machine, you can find the database file at <photo library root>/database/photos.db
. There's a table called RKMaster
, with a row for every photo, and a fileIsReference
column that tells you whether the photo is "external" or not.
The script I linked to simply dumps the list of all external files, and then iterates through to check that each one exists on disk.
Note that the table also includes an isMissing
column, but this is not good enough by itself. It only tells you about the files that Photos "knows" are missing, because you tried to double-click them, or use them in some way. If you simply delete a file from disk, but don't try to access it in Photos, the isMissing
column will be false.
I've found that the isMissing flag doesn't mean that the image is gone, just that it's not currently on disk. Using the Python script here, I was trying to copy all of my images out of Photos for backup. I noticed that several images were not being copied, and it turned out it was because they had the isMissing flag on them. But, I was able to take the image name (e.g., IMG_1234.JPG), search for it in Photos, and it found the image. And when I opened the image in Photos for viewing, there was a progress circle shown in the lower right corner (as though it was loading the file from somewhere), and when I checked the folder inside the Photos library on disk, sure enough, the missing file was now there. So now the mystery is, where are these "missing" files stored, and how do I access them (without having to visit each & every one within Photos)? And has anyone reverse engineered & documented the schema of the Photos SQLLite DB, including what the various fields mean, like "isMissing"? I haven't been able to find it myself.