Fix: iPhoto '11 library doubled size in Dropbox

The problem

The explanation

In the previous version of iPhoto, all your pictures and movies were stored in a folder named Originals, inside your library. In iPhoto '11 that folder was renamed to Masters and when you first launch it, your library is upgraded to the new structure.

Dropbox knows how to handle folder renames, that's not the problem. The problem is that iPhoto also creates a symlink named Originals, pointing to the new folder Masters. As Dropbox does not preserve symlinks, you end up with two identical folders in the server, duplicating all your photos and videos.

But unfortunately, there's more. The photos you have edited are saved to a different folder inside your library, named Modified. Guess what? This folder was also renamed and symlinked in iPhoto '11, now it's called Previews. And there goes another duplicates to the Dropbox server…

Since photo libraries tend to be huge, all this duplication can easily fill up all the available space in your Dropbox account.

Note that all this problem only affects upgraded libraries from previous versions of iPhoto. If you create a new library from scratch in iPhoto '11, the symlinks are not created and there's no duplication in Dropbox.

Those are the symlinks created inside an iPhoto library after the upgrade to iPhoto '11. Note that the thumbnails will be triplicated in Dropbox servers!

The fake solutions

You could just remove the symlinks, they seem useless. But it may corrupt your library, as noted by Thomas A. in the Dropbox Forums:

Removing the symlinks does not work. You can open your iPhoto library, but work with it for a while and you'll find new directories (yes, directories, not symlink) replacing the old symlinks. This, of course, leads to problems as you can imagine…

Do not use Selective Sync to uncheck those symlinks. It's not even a solution and due the Dropbox inner workings, all your pictures will be removed from the original folder!

Well, I used Selective Sync and 'removed' Originals/Modified, now all my pics are gone. — Johan S.

If you don't mind losing all your metadata (ratings, events, albums, etc.), just create a new library in iPhoto '11 (that comes with no symlink) and reimport all your photos and videos. But this is hardly an acceptable solution.

You can also wait until Dropbox really support symlinks, or maybe implement an special workaround for iPhoto libraries. According to the forum posts, both seem intangible in the near future.

Unfortunately this is a design decision that we made a very long time ago. There is no notion of symlinks in the Dropbox system (Windows XP didn't support symlinks) so our solution was to sync all the data within symlinks as if they were actual folders anyway. — Rian H., Dropbox employee
We could write special exceptions in the client but then that's another case for us to manage and keep track of and educate the user base. How many different apps will require a special exception from us? It's a road on a slippery slope that unfortunately we can't follow. — Rian H., Dropbox employee

The real solution

You must setup Dropbox to ignore the symlinks: no syncing, no removing. This is not a default feature, but it's feasible with some smart use of temporary empty folders and Selective Sync.

Are you ready?

Please, first make a backup of your iPhoto library, just in case. Then follow with full attention this excellent 10 steps guide, written by Dylan R. in the Dropbox forums:

  1. Quit Dropbox and iPhoto. We are gonna make some changes and don't want either program to freak out. If you have an automated backup (Time Machine, etc) running, either stop it or wait for it to finish, just to make sure that it doesn't pick up these changes.
  2. Right (or Ctrl) Click your iPhoto Library (should be in your Pictures folder in your Home folder), select "View Package Contents".
  3. Take any folder that is a symlink (they will have the little curly arrow overlay, like an alias) and drag it to your desktop (we'll be dragging them back later). Make note of all these file names as we'll use them several times. You can drag them anywhere really, so long as it isn't in your Dropbox folder. Just using Desktop as an example.
  4. For each folder that you dragged to your desktop, make a normal folder in the original place with an identical name.
  5. Restart Dropbox and let these empty folders sync. This should get your space back. Make sure you do NOT start iPhoto yet! We have to get that working again, first.
  6. Go to Dropbox Preferences, click Advanced, then Selective Sync.
  7. Click Switch to Advance View.
  8. Find your iPhoto Library, and UNCHECK all the dummy folders we just made. ONLY uncheck the empty folders we just made. Dropbox will now delete the (empty) folders from your hard drive.
  9. Drag all the symlinks back from you desktop into your iPhoto Library Bundle. They should hopefully have a gray minus sign on them, indicating that they are not being sync'd (what we want).
  10. Restart iPhoto. Since nothing changed as far as it can tell, it should work just fine. Just don't start iPhoto at any point before this step!

The real solution - Geeky version

### Quit iPhoto and Dropbox

$ cd ~/Pictures/iPhoto\ Library/               # Enter library
$ rm    Data Data.noindex Modified Originals   # Remove symlinks
$ mkdir Data Data.noindex Modified Originals   # Create dummy folders
$ open -a Dropbox                              # Launch Dropbox

### Wait until Dropbox is 100% synced.
### Uncheck the dummy folders in Selective Sync.
### Wait until Dropbox is 100% synced.

$ ln -s ./Thumbnails   Data.noindex            # Restore symlinks
$ ln -s ./Data.noindex Data
$ ln -s ./Previews     Modified
$ ln -s ./Masters      Originals
$ open -a iPhoto                               # \o/
— EOF —