My wife has had a long-standing issue with Photos crashing, going back several OS releases and at least 2 iMac’s, but until yesterday I’d been unable to witness it.

She is just scrolling through the library when all of a sudden the beachball appears and the machine freezes. Sometimes Photos will recover on its own, but usually it crashes. Fairly frequently a kernel panic will occur and the machine will shut down. Unfortunately the panic log just shows a WindowServer timeout which, as I understand it, is not indicative of the real problem.

I have no idea how to track this down, although I suspect that some support file has become corrupted. Anybody have an idea?

I suspect the database. Perhaps someone will know a tool that would rebuild it. I don’t. But the brute force way I might try would be to export all photos to a folder on the disk drive, create a new separate Photos library, and import all the photos into the new Apple Photos library. If the crashes go away, you would have your answer. Create additional photo libraries in Photos on Mac - Apple Support

If the Photos Repair Library is not working, you can open a new database, and transfer the pictures.
Also it would be worth to try to find out, if the crash occurs in the same “area” of the library, so with the same pictures showing up.
I had that a long time ago, that I had a corrupted picture, that causes the little sister of Photoshop (Elements?) to crash on my then Win95(I think!?) on a regular base.
I found it only by luck, but after the removal of the picture, everything run fine.

I tried the easiest suggestion first: repairing the library (thanks @anon20961960). It turns out I did this last year and it didn’t fix the problem, but I tried again, and again it didn’t fix the problem :frowning_face:

Next up: create a new library (thanks @karlnyhus and @Ulli). It turns out exporting photos and maintaining their metadata isn’t as simple as it could (should?) be. I found a command-line app called osxphotos on GitHub that looks promising. To be continued…


I’m not completely finished with this but I think I know enough to draw the conclusion that exporting all 30 thousand photos and then importing them into a new library seems to have cured the problem - which is not to say that Photos doesn’t crash now, because it does (at least once or twice), but no beachballs and no kernel panics. It turns out that, in order to maintain whatever metadata that is attached to a photo, you must not choose “Export Unmodified Original”. The command line utility (osxphotos) didn’t help in that regard but it provided a useful list of my photo library.

The real kicker here is that there is no way to export your albums. I wrote an AppleScript to create a list of all of the photos in each album, and then another one to find the photos in the new library and put them into albums. The only tricky part of this is that the photo names (like IMG_1234.jpg) aren’t unique throughout the album, so I had to save any photos with the same name to another album, which then has to be curated by hand - which is why Im not quite done yet.

All in all, a tedious and time-consuming exercise, but at least I have a more stable library. My thanks to all that responded.

Hi. I’m the author of osxphotos. It can definitely export all metadata (more than Photos actually can) and can preserve album structure. It also has an import feature that can recreate album structure and re-apply metadata, etc. Full documentation here. For example, to export with all metadata preserved in XMP sidecars and the folder path matching the album path, you could do this: osxphotos export /path/to/export --sidecar xmp --directory "{folder_album}".