Restore a Photos library from a Time Machine backup
If you back up your Mac with Time Machine, you can easily restore a photo library to the condition it was when the last backup was performed.
Note: If you use iCloud Photo Library and you restore the System Photo Library from a Time Machine backup, any photos you’ve deleted since the last Time Machine backup are restored to your Mac and uploaded to iCloud again. If you chose to optimize Mac storage, Time Machine may not have a backup of your originals. However, the originals are stored in iCloud.
If Photos is open, choose Photos > Quit Photos.
Click the Time Machine icon in the menu bar and choose Enter Time Machine.
Time Machine opens and shows your available backups
Click the date of your last backup, navigate to the backup of your photo library, then click to select it.
Click Restore.
Depending on the size your library, it may take some time for your library to be restored. When you next open Photos, you should be able to use your Photos library as it was when last backed up.