When you encounter the "unable to repair photos library" error on a Mac, it means the Photos app has detected a database corruption that its internal repair tool cannot resolve. To fix this, you must first attempt the built-in repair utility using a specific modifier key combination, and if that fails, you will need to restore the library from a Time Machine backup or recreate the library and import your original files. Note that menu labels and paths may vary slightly depending on your macOS version.

What You'll Need

  • A Mac with the Photos app installed.
  • Administrator privileges for the user account.
  • An external drive containing a Time Machine backup (if the built-in repair fails).
  • Sufficient disk space on your Mac or external drive to handle library duplication.
  • A stable internet connection if you use iCloud Photos.

Step-by-Step

  1. Force Quit the Photos App: If the app is frozen or displaying the error message in a loop, press Option + Command + Escape, select Photos from the list, and click Force Quit. This ensures the library file is not being accessed by a hung process during the repair attempt.
  2. Launch the Library Repair Tool: Close the Photos app completely. Press and hold the Command and Option keys simultaneously on your keyboard. While holding these keys, click the Photos icon in your Dock or Applications folder to open the app.
  3. Confirm the Repair: A dialog box will appear asking if you want to repair the Photos library. Click the Repair button. The system will now analyze the database, check for inconsistencies, and attempt to rebuild the library index. This process can take anywhere from a few minutes to several hours depending on the size of your library and the speed of your storage drive.
  4. Authenticate Your Account: Once the repair process finishes, Photos may ask you to enter your Mac user password or your Apple ID password to re-authenticate the library. Enter the required credentials to regain access to your media.
  5. Verify Library Integrity: Once the app opens, browse through several albums and check if your photos and videos are visible. If the library opens and your media is intact, the repair was successful.
  6. Restore from Time Machine (If Repair Fails): If the repair tool returns the "unable to repair" message again, you must use a backup. Close Photos. Open Finder and navigate to the folder where your library is stored (usually the Pictures folder). Delete the corrupted Photos Library file. Connect your Time Machine drive, enter Time Machine, and go back to a date before the corruption occurred. Select the Photos Library file and click Restore.
  7. Recreate the Library and Re-import (Last Resort): If no backup exists, you can try to salvage the raw files. Hold the Option key while opening Photos and select Create New. This creates a blank library. You can then right-click your old, corrupted library file in Finder, select Show Package Contents, and navigate to the Originals folder. Drag the folders containing your actual image files into the new, empty Photos library.

Common Mistakes

One of the most frequent mistakes is attempting to repair the library while it is stored on a network drive or a cloud-synced folder (like Dropbox or OneDrive). The Photos library is a complex package that requires a local, APFS or HFS+ formatted drive to function correctly. If the library is on a network share, the repair tool often fails immediately because it cannot gain the necessary file-system locks.

Another common error is interrupting the repair process. Because the repair tool does not always provide a detailed progress bar, users often assume the app has frozen and force quit it. Interrupting a database rebuild can lead to further corruption, making it impossible to recover the library without a backup. Always allow the process to finish, even if it seems stalled.

Users also frequently forget to check their available disk space before starting a repair. The repair process often creates temporary files and database logs. If your hard drive is nearly full, the repair tool may fail simply because it has no room to write the corrected database, leading to a false "unable to repair" error.

Tips

To prevent future corruption, always ensure that your Mac is not shut down improperly. Hard restarts or power failures while the Photos app is indexing or syncing with iCloud are primary causes of library database failure. Always use the Apple menu > Shut Down command.

If you store your library on an external drive, ensure the drive is formatted as APFS or Mac OS Extended (Journaled). Using ExFAT or NTFS drives for a Photos library is not officially supported and frequently leads to the very corruption errors that trigger the repair tool. If your drive is ExFAT, move the library to a Mac-formatted drive immediately.

Regularly verify your Time Machine backups. A backup is only useful if it is current and functional. Periodically check that your Photos library is being included in the backup rotation by browsing the backup history in the Time Machine interface.

Troubleshooting

If the repair tool fails and you do not have a Time Machine backup, check if you have iCloud Photos enabled. If your photos were syncing to the cloud, you can create a brand new library (Option + Open > Create New) and sign into your iCloud account. The system will then download your photos from the cloud back to your Mac. This is often the fastest way to recover media when the local database is destroyed.

If the app crashes immediately upon launch before you can even attempt a repair, try booting your Mac into Safe Mode. Restart your Mac and hold the Shift key (for Intel Macs) or hold the power button until Startup Options appear and select the disk, then hold Shift (for Apple Silicon Macs). Safe Mode clears certain system caches and disables third-party extensions that might be interfering with the Photos app's ability to access the library file.

In cases where the library is on an external drive and won't repair, check the drive's health using Disk Utility. Select the drive and click First Aid. If there are underlying disk errors or bad sectors, the Photos repair tool will fail because it cannot write to the damaged parts of the physical disk. Fix the disk errors first, then attempt the Photos repair again.

Frequently Asked Questions

Will repairing the library delete my photos?

The repair tool is designed to fix the database index, not delete your media. However, if the corruption is severe, some database entries (like albums or facial recognition data) might be lost, though the actual image files usually remain safe.

How long does the repair process usually take?

It varies wildly based on the library size. A library with a few thousand photos may take ten minutes, while a library with hundreds of thousands of images and 4K videos can take several hours.

Can I use a third-party app to repair the library?

It is highly recommended to use the official Apple repair tool or Time Machine. Third-party "repair" tools often claim to fix libraries but may further corrupt the proprietary package structure of the Photos library.

What is the difference between a library and the Originals folder?

The library is a package containing a database that tracks your edits, albums, and metadata. The Originals folder inside that package contains the actual, untouched image and video files.

Why does my library keep getting corrupted?

Common causes include disconnecting an external drive without ejecting it first, running out of disk space, or using an unsupported drive format like ExFAT.

Can I repair a library that is stored in iCloud?

You cannot repair the cloud version directly; you repair the local copy on your Mac. Once the local copy is repaired and synced, the corrected state is reflected in your iCloud account.