I had a quick question regarding the file path of photos app. I am trying to run a bash/AppleScript script that accesses my photos app via terminal and uses the ls command to print all the file names to a .txt document though I can't seem to find the right file path chatgpt keeps giving me the following "/Users/alekburt/Pictures/Photos Library.photoslibrary/Masters" but that doesn't seemed to be recognized any help is appreciated

  • Do you me$an the path to the app or to the actual photos which is the data the App uses? If the latter then in the app goto Settings and the first entry is Library Location.
    – mmmmmm
    Apr 23, 2023 at 13:22
  • hmm good question I don't really know which ever would allow me to print all the filenames to a .txt document which I would assume would be the latter? Apr 23, 2023 at 13:24
  • Also know that chatGPT does not give accurate answers
    – mmmmmm
    Apr 23, 2023 at 13:25
  • Probaly then ~/Pictures/Photos Library.photoslibrary - but they are all stored in a hased database so not much use.
    – mmmmmm
    Apr 23, 2023 at 13:26
  • 1
    With recent versions of Photos, pictures are indeed not stored using their name. What do you want to do with the text file once you have it generated?
    – nohillside
    Apr 23, 2023 at 13:36

1 Answer 1


Welcome to Ask Different. You may be asking the wrong question so I'll put up an answer in hopes it helps you with an answer. This whole topic might belong on meta since you're asking what appears to be an XY question.

Rather than describe what you want to do - perhaps you wish to iterate over photos to gather statistics on which are new or perhaps perform some action on some or all of them. Instead of that you are asking about the first step you think will help you solve it - "can I enumerate the photos on the filesystem using ls"?

But - let's get you an answer. The Photos app uses a somewhat complicated database schema to store the filesystem locations (and names of images, faces, metadata, etc...) of photos and identify them. You will need the sqlite3 command and to de-obfuscate the hashes and table structure for most recent versions of the app.

The database is stored in ~/Pictures/Photos\ Library.photoslibrary but using those database files is not easy (to me at least).

Also, images are stored in multiple resolutions with machine-generated names - not picture0001.heic or whatever you might expect when you export an image. The "one image" has multiple manifestations - thumbnails, edited, original, limited resolution, full resolution - so your process/tool/script will need to contemplate and decide which if any of these are needed. Not all photos will be resident locally as well if you are using iCloud to host the authoritative copy of the pictures.

So, your problem might be solved much easier if you used a tool like Automator to export the photos to the filesystem and then use tools like ls to do your operations.

  • okay, wow I wasn't aware of the intricacies of this, ill re-evaluate my approach do you think AppleScript alone would be a better option? Apr 23, 2023 at 14:07
  • 1
    @AlekNaomieBurtPilon you are missing the point - the solution might not be complex - but please explain what you are trying to do from first principles as if to someone who just uses Photos and has no idea about anything except the app.
    – mmmmmm
    Apr 23, 2023 at 14:27
  • im trying to get a .txt list of every file name currently in my photos app Apr 23, 2023 at 15:37
  • @AlekNaomieBurtPilon We understand that. What do you intend to do with the list afterwards (there might be other ways to accomplish this, without creating a list first)?
    – nohillside
    Apr 23, 2023 at 16:03
  • No @AlekNaomieBurtPilon You will want to get the photos out of Photos app entirely unless you are up for a very large programming challenge.
    – bmike
    Apr 23, 2023 at 17:30

You must log in to answer this question.

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