Recently I noticed when I delete photos from the iPhoto trash, iPhoto doesn't necessarily delete the image files from its library. My iPhoto library is the single biggest thing on my MacBook Air's hard drive, and it's the reason I had to pay extra for a 256GB SDD rather than use the stock 128GB one. I'm in the habit of taking a bunch of shots of every subject to make sure at least one has the correct focus, exposure, and is level. All this is to say I have a lot of extra photos that I need to get rid of.

But as I noticed, sometimes iPhoto doesn't delete photos when you empty the iPhoto trash. It just removes them from its database so they're no longer visible without deleting the actual image files. Those files still use up disk space—to the tune of 10 GB, in my case.

It's not clear to me why iPhoto fails to remove unwanted images from its library, but it looks like this started to happen when I switched from downloading images off my camera using the USB cable to plugging the SD card directly into my computer (not sure if that's a relevant data point though).

So, after a little tinkering, here's how to get rid of those unwanted photos and reclaim that disk space in eight easy steps:

Step zero—Make sure you have your iPhoto library backed up properly.

Step one—Make an album in iPhoto. Drag all your photos to that album. (iPhoto may take a second or two to respond once you've selected several tens of thousands of photos.) A good name for this album is "keep." Do this before step two, which requires repairing the database.

Step two—Find your iPhoto library (in ~/Pictures/ by default) or the iPhoto app in the Finder. Open the library or the application and immediately press the command and alt/option keys. This way, when iPhoto opens, it presents four photo library first aid options. Select the third, "repair database." This will make iPhoto scan all the photos in the library and restore missing ones to the database so you can see them.

Step three—Create a smart album "don't keep" that matches all the photos that are not in the "keep" album:

Step four—All the not-really-deleted photos, as well as any photos that got lost along the way somewhere, now show up in the "don't keep" smart album. (Any photos that you've added to the library after step one are also here.) You may want to look them over and see if there are any photos in there that you want to keep after all. If so, drag them to the "keep" album, and they'll disappear from the "don't keep" album.

Step five—Move the photos from the "don't keep" album to the iPhoto trash. Because "don't keep" is a smart album, all the menu options for deleting photos are grayed out. But you can still move photos to the iPhoto trash with the keyboard combination command-option-backspace.

Step six—Go to the iPhoto trash and note how many photos are there in the upper right corner of the window. Click "empty trash."

Step seven—Go to the Finder trash. There should be an iPhoto folder in it. Check (using "get info") whether that iPhoto folder has the same number of items in it that iPhoto's trash had before you emptied it. Folders also get counted, so the number won't match precisely. But from what I've seen, either iPhoto deletes everything or it's not even close. It should be fairly obvious whether the trash emptying was successful. If not, go back to step one, although I've never seen deletion of a specific photo fail a second time.

Step eight—Empty the Finder trash and enjoy your recovered disk space.

Step nine—There is no step nine, just glorious disk space.