Where does the Photos app store its files? How do I find out programmatically where the Photos app stores all the pictures?

Before answering that it's always

~/Pictures/Photos Library.photoslibrary/


, please be aware that this is only true for English installations of Mac OS. For example, in French, the folder is called

~/Pictures/Phototèque.photoslibrary/


and in German,

~/Pictures/Fotos-Mediathek.photoslibrary/
It's not as simple as changing the path based on the locale. The Photos library could be renamed and moved anywhere. You can find the current library by extracting the IPXDefaultLibraryURLBookmark from the Photos plist.

/usr/libexec/PlistBuddy -c "print IPXDefaultLibraryURLBookmark" \
~/Library/Containers/com.apple.Photos/Data/Library/Preferences/com.apple.Photos.plist


The IPXDefaultLibraryURLBookmark contains a CFURLRef. This will require deserialising.