4

Is there a command line utility to allow browsing and editing photos in the Apple's Photos.app database like you would browse a file system? The Photos app is really terrible when trying to perform operations on large data sets (in my case, delete all of the thumbnails that I accidentally imported) as it foolishly tries to load all of the photo metadata into memory when making selections of matching files to perform any select and this brings my computer to a halt as it allocates 101 GB of virtual memory and it just sits there paging for hours.

I have tried to use third party de-duplication tools, but they are all terrible. I really just want to perform some basic operations on them using tools like exiv2 and GraphicsMagick to write some shell scripts to do get what I need done so I don't have to put up with Apple's nonsense with Photos.

Any ideas? I have not found anything yet. Honestly, a Fuse plugin would be ideal, but alas such a thing does not seem to exist.

4
  • A photo library is just a special folder. You can cd into it like into any other folder.
    – nohillside
    Dec 29, 2018 at 7:25
  • “~/Pictures/Photos Library.photoslibrary”? Yes you can cd into it but that’s about all you can do. You can’t even ls the contents.
    – Darf Nader
    Dec 29, 2018 at 7:31
  • Can't reproduce this here. I can easily run ls, copy images out, remove images (with some risk of having to rebuild the library) etc. You should be also be able to do this in Finder (right-click -> Show Package Content). If it doesn't work, please run ls -del@on the library and add the result to the question.
    – nohillside
    Dec 29, 2018 at 9:37
  • Access to these files has been significantly different in different MacOS versions. As of MacOS 11, the Finder access is thwared because all files have intentionally-scrambled names. (Can't speak for MacOS 12.) Aug 15, 2022 at 21:05

1 Answer 1

1

osxphotos is a Python app that uses Apple's PhotoKit to let you query & export asset files, original or modified, plus all the various metadata from the Photos library. I haven't used it yet, but it looks promising. There's a command-line utility and a Python interface to the API.

I'm not sure if this alone is enough to de-duplicate with; it seems to mostly be read-only. One could find duplicates with it, delete them from the filesystem with normal Unix tools, and then ask the Photos app to clean up the dead links in its own database. I strongly urge you to make a backup before you try that. =)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .