e.g. you’re trying to view the package contents of the “Photos Library” (in /Users/[username]/Pictures/), so you can check an original file, RAW image, etc. – but you’re not thinking properly, accidentally click the wrong option in the menu and send the entire contents to the Recycle Bin by mistake.
You stop the deletion immediately, and the Photo Library isn’t in the Recycle Bin, and still appears to be in the usual location in the Finder, but, on launching Photos (macOS Mojave 10.14.6, in this case) it says it has failed to repair the library and invites you to open another one.
The fix is very simple – first, disconnect your Time Machine drive (or any other automated backup location) to avoid harming your backups.
- close Photos if it’s open
- hold down the command + option (alt) keys while clicking the icon
- the Photos app will open and should immediately offer to repair the library for you.
- supply password when prompted
- wait a while (a few minutes for 80GB of photos in my case) while the photolibraryd process rebuilds the library (you’ll see a fairly accurate progress meter)
- browse / continue to use the library for a while to check everything is still there and ok (mine was).
On a related note, I highly recommend Adobe Lightroom Classic (superbly well thought out app, very powerful and perhaps also the best designed keyboard shortcuts I have ever seen). The £10 a month Creative Cloud subscription is worth it (get the one that also gives you Photoshop). It’s considerably better at things like HDR and spot removal/healing brushes than, for example, Pixelmator Pro, Affinity Photo etc.
Only issue is that it can eat memory. Keep an eye on that and be prepared to relaunch if it, as has happened to me a couple of times, it creeps up to 9GB.