Unable to open the photo library

Fix 'Photos Library Cannot Be Opened' on macOS

That 'Unable to open the photo library' error usually means the Photos database or permissions got corrupted. Here's how to repair or rebuild it without losing pics.

You double-click Photos, and instead of your library, you get a dialog saying it can't be opened. Annoying, especially when you've got years of pictures in there. The good news: this is almost always fixable, and you rarely lose anything.

First, try the repair option

Hold down Option + Command and click the Photos icon in the Dock or Applications folder. Keep holding until a dialog appears asking if you want to Repair the library. Click Repair. Photos will run a consistency check, rebuild thumbnails if needed, and fix the database. This can take a while if your library is large — 50,000 photos might take 20–40 minutes. Let it finish. Don't force-quit.

If that works, you're done. If it doesn't, or the Repair option doesn't show up, move to the next step.

Rebuild the library from scratch

The nuclear option, but it's the one that actually fixes stubborn corruption. Before you do anything, make a copy of the entire Photos Library.photoslibrary package. Right-click it in Finder and choose Duplicate. That copy is your safety net.

  1. Quit Photos completely (Command + Q).
  2. In Finder, go to your Pictures folder (or wherever the library lives — often an external drive).
  3. Right-click Photos Library.photoslibrary and select Show Package Contents.
  4. Inside, find the database folder. Rename it to database_old.
  5. Also rename the resources folder to resources_old if it exists — this forces a full rebuild of derived data.
  6. Close the package window. Now hold Option + Command and launch Photos again.
  7. When prompted, choose Repair (or if it offers to create a new library, point it at the existing one).

Photos will rebuild the database from the originals stored in the Masters folder inside the package. This takes time and disk space, but your actual image files are untouched. The new database references them correctly.

Don't delete the database_old folder until you've confirmed everything works. It's your rollback.

Why this actually fixes it

The Photos Library.photoslibrary package is really a folder disguised as a file. Inside, there's a SQLite database that tracks every photo's metadata, edits, albums, and faces. When that database gets corrupted — from a sudden power loss, a kernel panic, a failing external drive, or even a bug in a macOS update — Photos can't read it and throws the "unable to open" error.

Renaming the database folder forces Photos to ignore the broken file and build a new one from the actual image files. The originals in the Masters directory (or originals in newer versions) are just JPEGs, HEICs, and RAWs sitting on disk. They don't care about the database. So Photos re-scans them and reconstructs everything it can. You lose some non-destructive edits if they weren't saved to the originals, and you lose albums and face tags unless they're recoverable from the old database. But your photos survive.

Less common variations

Library is on an external drive that won't mount

If the drive itself is failing, Photos will report the same error. Check Disk Utility first. If the drive mounts but Photos still fails, the filesystem might have errors. Run First Aid on it. On APFS volumes, First Aid is usually enough; on HFS+, you might need fsck_hfs from Terminal in Recovery mode.

Permissions got mangled

Sometimes the library's permissions get changed by a migration or a backup restore. Open Terminal and run:

sudo chown -R $(whoami) ~/Pictures/"Photos Library.photoslibrary"
sudo chmod -R u+rwX ~/Pictures/"Photos Library.photoslibrary"

Replace the path if your library lives elsewhere. This resets ownership to your user account and gives you read/write access. It's a quick fix if the error is permissions-related, which you can confirm by checking Console.app for "Operation not permitted" messages when Photos tries to open the library.

iCloud Photos sync conflict

If you use iCloud Photos and the library is partially synced, a conflict between the local database and iCloud can trigger the error. Sign out of iCloud (System Settings > Apple ID > Sign Out), restart, then sign back in. Let it fully re-sync before opening Photos. This is rare but happens after a macOS major upgrade like Ventura to Sonoma.

Third-party app locked the library

Apps like Adobe Lightroom, Capture One, or even backup utilities can hold a lock on the library package. Quit them all, then try Photos again. You can check for open files with lsof | grep Photos\ Library in Terminal.

Preventing it next time

  • Don't force-shutdown your Mac while Photos is open. That's the number one cause of database corruption. Give it a few seconds to finish writing.
  • Keep the library on a reliable drive. External USB spinning disks are fine, but cheap SSDs with flaky controllers cause exactly this error.
  • Back up with Time Machine or a clone. If you have a recent backup, you can restore the entire .photoslibrary package and skip the rebuild.
  • Update macOS promptly. Apple has fixed several Photos database bugs in point releases — 13.4.1 and 14.2 both patched corruption issues.
  • Don't move the library while Photos is running. Same reason. Let it close cleanly.

If none of this works, your drive might be dying. Run DriveDx or check SMART status in Disk Utility. A library that repeatedly corrupts is a symptom, not the disease.

Related Errors in macOS Errors
macOS Mail app stuck after Gmail password change Install Failed – An error occurred while installing the selected updates. macOS 'Install Failed' Error on Big Sur or Monterey Operation not permitted macOS Errors: Fix 'Operation Not Permitted' on Terminal macOS 'The operation can’t be completed because the item is in use' – Fix

Was this solution helpful?

EP
Erropedia Team
Tech Support Editors
The Erropedia editorial team researches and documents real-world tech errors from across Windows, Linux, macOS, networking, databases, cloud platforms, and more. Every solution is reviewed for accuracy and updated as software and systems evolve.