This article explains how to back up photos on a Mac from the Photos app or the iPhoto app (for OS X Yosemite and earlier).
How to Move Your Mac Photo Library to an External or Other Drive
If you use the iCloud Photo Library service, the images in your Photos or iPhoto library are stored in iCloud. New photos you take with your iOS device are added to iCloud and are accessible on all of your devices that have iCloud Photos turned on.
The best way to back up your iCloud Photo Library is to download its contents to your Mac. If your Mac doesn't have enough hard drive space, back up your iCloud Photo Library to an external drive connected to your Mac.
Open the Photos app on your Mac by clicking its icon in the Dock.