Menu

Colin Devroe

Photographer. Podcaster. Blogger. Reverse Engineer.

How to move referenced originals in Photos for Mac

Warning!! I’ve only just hacked this solution together and I don’t fully understand the ramifications of my actions yet. If there are any, I will update this post.

First, a bit of context on how I use Photos for Mac (Photos).

I do not allow Photos to store my original files within its “package”. I have my reasons. When I import photos I check the box labeled “Keep Folder Organization”. This way, I can keep my photos in a directory structure of my choice rather than how Photos chooses to organize them.

I wanted to take one of my photo libraries (I have two) on the go with me on a portable external hard drive that I can keep in my bag. After much searching I could not find anything that explained how to move my original photos from one external hard drive to another and have Photos recognize this change.

So finally, I had a few moments to spare, and I figured I would dig under the hood of Photos to see how it kept the references to these files and see if I could update those references to the new location.

Photos uses a SQLite database to store much of the information it needs to do what it does. Things like facial recognition, album names, keywords, etc. are all stored in a heap in this database. In a few locations, it turns out, it also stores the path to each individual original photo in your library.

So far (one night, as of this writing) this solution has seemingly worked for me. I will continue to play around with the results to see if I can uncover some adverse side effect. Until then, here are the steps I took to move an entire original photo library onto a portable external hard drive.

Photos’ SQLite database viewed in Sqlitebrowser
  1. Make a copy of your .photoslibrary file. Just in case.
  2. Copy all the original photos from one drive to the other. For me, this was simple. I keep my photo library originals in separate directories so I can copy a single directory and grab them all. For me, this was /Volumes/Hard Drive 1/Carbonite Photo Storage/Photography Projects/ to /Volumes/Hard Drive 2/Photo Archive/Photography Projects/
  3. Open the Photos.sqlite database found within the Photo Library package contents. Secondary-click on your .photoslibrary file, select Open Package Contents and navigate to database/Photos.sqlite (I used Sqlitebrowser)
  4. Update the ZNAME and ZVOLUMEUUIDSTRING fields in the ZFILESYSTEMVOLUME table. To get the new values, open the System Information app on macOS and find the new values for your hard drive under Hardware > Storage. I could not find ZVOLUMEUUID anywhere so I left it as-is. No idea if this will come back to bite me.
  5. Update the ZFILESYSTEMBOOKMARK table with the relative paths to the originals. To do this, I ran the following SQL – UPDATE ZFILESYSTEMBOOKMARK SET ZPATHRELATIVETOVOLUME = REPLACE(ZPATHRELATIVETOVOLUME, 'Carbonite Photo Storage', 'Photo Archive')
  6. Update the ZGENERICASSET table with the new paths for all photos on the ZDIRECTORY field. To do this, I ran the following SQL – UPDATE ZGENERICASSET SET ZDIRECTORY = REPLACE(ZDIRECTORY, 'Hard Drive 1/Carbonite Photo Storage', 'Hard Drive 2/Photo Archive')
  7. Save the Sqlite database file.
  8. Open Photos!

One way to tell if this worked for you is to open Photos, choose a photo from your library, and select “Show Referenced File in Finder”. This will open a Finder window with the selected file in its location. If it opens to the new hard drive you copied your originals to, it worked.

I’m going to be using this library a fair bit in the coming days and so I hope that if there are any issues with this approach I will find them quickly and can update this post. See also the comments in case others try this and leave some feedback.