If you have had issues with Apple’s Aperture using referenced files then this post may be of some help. In my previous posts here and here I detailed the issues that I have been experiencing and some of the steps I tried to get back working. If, like me, you are still banging your head against the wall, you may want to consider manually updating the Aperture Library Database file.
The process described below is for more advanced/daring users. I’ve tried to recount everything I’ve done, but may have left some bits out. Please be careful and understand all the steps below before proceeding. As always YMMV.
For this procedure to work, you will need to have a file stored on the new location of your referenced images that Aperture successfully knows about. Without it you will not have the proper UUID that Aperture uses to locate the images. I suggest moving a test/temporary image to the volume you want your referenced images to be stored.
The db file is in a slightly different location than for iPhoto but is not too hard to find. Right click your Aperture Library and select ‘Show Package Contents’. In the directory window navigate to Database > apdb > Library.apdb.
Here is where things get scary. You will want to be EXTREMELY careful with this file. Please proceed at your own risk, I make no promises that this will work for you. I suggest making backups, and backups of the backups of this file.
You will need to manually edit the database in SQLLite3. I changed the filename from Library.apdb to Library.apdb.ORIG and then copied out that file to the root of my HD.
I used SQLLite Manager to run the commands against my DB. It is a nice little plugin for Firefox that worked really well. Open SQLLite Manager and select the Libaray.apdb file that you copied out onto your drive. (You have to have moved the library file as SQLLite Manager will not be able to look into the contents of your Aperture Library)
Below are the commands that I used to update the file path for my referenced images.
--This command will show you the UUID of the volume where your images were stored as well as the directory path. SELECT filevolumeuuid, imagepath FROM rkmaster
You will need to check the filevolumeuuid field for images that are not stored in your Library. Images that are stored outside the library will have a value in this field. It will be something long and cryptic and will not be a readable name. Copy out this value into a text file. You will also need to note the UUID of the volume where you moved the test/temp image above. This is the new UUID you will be changing to later.
In my case, since I moved my images to a temp folder at the root of a dive, I only needed to add a folder name to the beginning of my directory location. The first command below concatenates the folder name to the beginning of each ‘imagepath’ record where the record is on the original referenced volume.
--This command updates the directory path to your temp location. UPDATE rkmaster SET imagepath = '<AddNewFolderPathToBeginningOfImagePath/>' || imagePath WHERE filevolumeuuid = '<OldFileVolumeUUID>'
--This command will change the UUID to the new volume where your images are stored. UPDATE rkmaster SET filevolumeuuid = '<NewFileVolumeUUID>' WHERE filevolumeuuid = '<OldFileVolumeUUID>' --This command will should show you the updated UUID and directory path. SELECT filevolumeuuid, imagepath FROM rkmaster
Once I had completed the above, I renamed the file back to Library.apdb and moved it back to the proper location in the Aperture Library. After launching I was able to verify that all the images show as connected on the new path that I just manually changed.
In my case, I just wanted to get everything under Aperture control again, so I selected all images in my library, and ran the ‘Consolidate Masters’ command to get all the Masters loaded back into the Aperture Library itself and away from the ‘Managed’ structure. This cleaned out the files from my temp location and left me with a fully operational library that will hopefully be free of these type of issues moving forward.
The last step I recommend is backup, backup, backup. And then verify that your backup will work! For me a got a nice drive dock that allows me to swap in any SATA drive I want. With that I run TimeMachine. I also backup to SDLT tape every month. Like I said, I’m a backup freak! You cant be too careful.