Photo Stream without Photos app for Mac



I love using Photo Stream on my iPhone and iPad, but don't want to use the Photos app for Mac. iCloud Photo Library is great for the majority of people, however for my needs it will not work. There are a few reasons for this:

1) I sync all of my photos to my wife's Windows PC (with OneDrive). Since Apple most likely will never have a Photos app for Windows, this is not an option.
2) I want to keep an organized folder structure for my photos (saved to OneDrive).
3) I like to organize my photos by categories/sub-categories.
4) I cannot easily find photos organized by year. I could recreate all my folder categories with Photos albums, however that would be very time consuming.
5) I also do not want to have all of my photos stuck in one application. The way I have my photos organized now will be easily accessible in 30 years on any system.
6) Not as big of a deal, but I don't want to pay extra for iCloud storage every month.

Photos for Mac, much like iPhoto did, stores your photos inside a single library in your Pictures folder. You can view these photos by right-clicking on the library file and selecting Show Package Contents. The full size/resolution photos are saved inside the Masters folder. With my script, we will be transferring these photos out so you can organize them in your own folder structure in the Finder.


I use the free Exiv2 to rename my photos with the date and time recorded in the exif data from the iOS device. You can download Exiv2, however it's much easier to install it with Homebrew. The command will be "brew install exiv2".


Before you save the script, you will want to create a few folders that the script will use:

1) The Temp folder for photos to sit in while they are being renamed, I have mine right inside the Pictures folder.
2) The New Pictures folder where your Photo Stream photos will be saved.
3) The Photo Stream folder where another copy of your Photo Stream photos will be saved as a 90 record (this one is optional).


To use this script, just copy everything below into a new file. Each step is commented. Change the destination paths for the three folders you created above.

#!/bin/bash


#Copy photos to Temp folder
find ~/Pictures/Photos\ Library.photoslibrary/Masters/ -type f -exec cp "{}" ~/Pictures/Temp/ \;


#Rename photos with date and time (The path to exiv2 may be different if you do not use Homebrew to install or if the version is different.)
cd ~/Pictures/Temp
/usr/local/Cellar/exiv2/0.24/bin/exiv2 -r'%Y-%m-%d_%H%M_:basename:' rename $(ls)


#Copy photos to _New Pictures folder
find ~/Pictures/Temp/ -type f -exec cp "{}" ~/Pictures/_New\ Pictures/ \;


#Move Photos to Photo Stream folder (This is optional, but allows you to maintain another untouched copy of every photo taken on all your iOS devices. This comes in handy since we have two iPhones and an iPad.)
find ~/Pictures/Temp/ -type f -exec mv "{}" ~/Pictures/Photo\ Stream/ \;


#Remove folders (This is optional, but will delete the empty Masters folders and also the thumbnails. Be aware that Photos for Mac will be emptied out every time you do this.)
rm -r ~/Pictures/Photos\ Library.photoslibrary/Masters
rm -r ~/Pictures/Photos\ Library.photoslibrary/Thumbnails


#Keep only the last 90 days of photos in the Photo Stream folder (This is optional and if you didn't enable this copy above you don't need this. If you do keep this in, it is nice to just have it auto-delete the older photos and not fill up your hard drive.)
find ~Pictures/Photo\ Stream/ -mtime +90 -type f -mtime +90 -exec rm {} \;

Save the file with an .sh extension and change the permissions on the file with Terminal so you can execute.

$ chmod 700 photostream.sh

You can also have this run automatically at certain intervals by scheduling it with launchd.

I use Lingon to edit launchd scripts. Here is the setup:

Or you can create the script manually. Go into ~/Library/LaunchAgents/ and create a new file. The file naming format for launchd scripts is com.developer.name.plist, so I named mine com.peter.photostream.plist. Then paste in the below script:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
   <key>Label</key>
   <string>com.peter.photostream</string>
   <key>ProgramArguments</key>
   <array>
       <string>/Volumes/Macintosh HD 2/Dropbox/Scripts/photostream.sh</string>
   </array>
   <key>StartInterval</key>
   <integer>60</integer>
</dict>
</plist>

You can adjust the StartInterval to whatever you want, I have set mine for every 60 seconds. Be sure to also change the Label to whatever you named your file.


Now whenever you take photos with your iOS devices, all photos in the Photo Stream will be saved to a folder on your Mac without the need to use the Photos app.