Archive. This is an archive of the Apple Support Community. Discussions are being restored and soon you will be able to read and post here again.

After upgrading to MacOS 27.2 TimeMachine from MacOS 26 will not complete. Stuck on a photos sql file

After upgrading to MacOS 27.2 from MacOS 26 TimeMachine will not complete and fails with message


“/Users/bill/Pictures/Photos Library.photoslibrary/private/com.apple.mediaanalysisd/MediaAnalysis/vector_database/index.sql” could not be backed up.


I restored my library from iCloud and it still fails. I have restarted the system several times just to see if that would help hoping it might free up a lock or contention on that sql file. It still fails consistently on that file.


Any suggestions?

2 replies

This error occurs because the com.apple.mediaanalysisd folder stores temporary, local search index and computer vision caches that frequently lock up or break permissions during major macOS upgrades. Restoring your library from iCloud did not fix it because macOS immediately recreated this local database folder and ran into the exact same file-locking issue.


Because this specific directory contains machine-learning data (like facial recognition and object indexing) that your Mac can automatically regenerate, you can safely bypass or reset it.


Follow these steps to fix the issue:


Solution 1: Clear the Corrupted Cache File

You can safely delete the cache directory so macOS can generate a fresh, uncorrupted version.

  • Quit the Photos app completely.
  • Open Finder, click Go in the menu bar, and choose Go to Folder... (or press Command + Shift + G).
  • Paste the following path and press return:
~/Pictures/Photos Library.photoslibrary/private/
  • Locate the folder named com.apple.mediaanalysisd.
  • Move that folder to the Trash and empty it.
  • Restart your Mac. Your system will automatically create a brand new, unlocked index file, allowing Time Machine to proceed normally.


Solution 2: Exclude the private folder from Time Machine

Since this database updates constantly and can be completely rebuilt by macOS if you ever need to restore your photos, there is no practical reason to back it up.

  • Open System Settings > General > Time Machine.
  • Click Options... in the bottom right corner.
  • Click the + (plus) button to add an exclusion.
  • Press Command + Shift + G to open the "Go to Folder" prompt.
  • Paste the path to the internal private directory of your library:
~/Pictures/Photos Library.photoslibrary/private/
  • (If your Photos library has a different name or location, navigate directly inside it to the private folder).
  • Click Exclude, then click Done.
  • Try running your Time Machine backup again.


More info from Apple: Exclude files from a Time Machine backup on Mac - Apple Support



Thank you. I was a little concerned about deleting the file but... it worked and I can now do TimeMachine backups again.