How to use Flickr favourites as your screensaver in OS X Yosemite, Mavericks and Mountain Lion

Mountain Lion was an improvement on Lion, which I had mixed feelings about when it was released. Unfortunately, however, Apple apparently decided that RSS is a dead technology (although it seems to be creeping back into Safari), and consequently the handy RSS screensavers were removed, which means there was no simple way of creating a screensaver out of one’s Flickr favourites in Mountain Lion, and this remains the case in Mavericks and Yosemite.

Having come up with an effective solution for how to get Flickr favourites as a screensaver in Mountain Lion which also works in Mavericks and Yosemite, I thought I’d share the method for the benefit of those who are not so used to fiddling with the deeper technological aspects of their Mac. I’ve gone into quite a lot of detail for those who are less technically-minded, but those of a more technical bent can just skip ahead accordingly.

Yahoo! keeps changing the Flickr website and API which keeps breaking some of my instructions, so I’m constantly modifying this post so that it stays up to date for getting your favourites from the new Flickr website to use as a screensaver in Yosemite, Mavericks and Mountain Lion. I last updated these instructions on 28th October 2014 and they tested out fine on that date.

Set up the RSS feed

Thanks to Rudie for emailing me to point out that Flickr has apparently started providing large versions of images in its RSS feeds, so this part is now much simpler than it was before.

Firstly you need to get your Flickr ID. I’ve gone back to using idGettr for this after it stopped working for a while (presumably also due to constant Flickr API changes) but then became operational again. So, follow the simple instructions at idGettr, and what you need to take note of is the Flickr ID, which looks something like 39653492@N07.

Then simply add that to the end of the Flickr photo RSS feed address so you end up with something like this, but with your own Flickr ID at the end instead of mine:

https://api.flickr.com/services/feeds/photos_faves.gne?id=39653492@N07

Paste this link into a temporary place so you can come back to it shortly – a temporary document in TextEdit is as good a place as any.

Create the folders you need on your Mac

From here on it is necessary to venture into the dark underbelly of OS X via the use of the Terminal. So, launch the Terminal app using your preferred launch method. If you’re not sure how to do this, type ⌘-Space to bring up Spotlight, then type “terminal”, then choose “Terminal” in “Applications”, then hit Enter to launch it. Then we make sure we have the folders we will need, so type (or copy and paste) the following line into the Terminal:

mkdir -p ~/Pictures/Flickr_faves ~/Library/Scripts ~/Library/LaunchAgents

Create the script to download the images

The first thing we need to do next is determine what your short username is. On OS X, every user has a long username and a short username. For example, my long username might be “Matt Brock” and my short username might be “mattbrock”. If you already know for sure what your short username is then that’s great. If not, then just type the following into the Terminal and it will tell you:

echo $USER

Make a note of this somewhere if you’re not sure you can remember it. Next we create the script which will get the latest favourites and clear out old ones, so type:

nano ~/Library/Scripts/get_Flickr_faves.sh

This will bring you into a text editor. Paste in the following text:

#!/bin/bash

if ! cd ~/Pictures/Flickr_faves ; then
  logger "get_Flickr_faves: failed to cd to ~/Pictures/Flickr_faves; exiting"
  exit 1
fi

if ! curl -s "http://api.flickr.com/" > /dev/null 2>&1 ; then
  logger "get_Flickr_faves: couldn't connect to Yahoo API; exiting"
  exit 1
fi

curl -s "URL" | grep 'rel="enclosure"' | awk -F '"' '{print $6}' | xargs -L1 curl -s -O

find . -mtime +1 -exec rm -f {} +

NO_IMAGES=$(ls | wc -l | sed "s/ //g")

logger "get_Flickr_faves: completed; $NO_IMAGES images"

Then use the arrow keys on your keyboard to move around. You need to replace URL with the long RSS feed address which you pasted into a temporary location earlier – you can use regular copy and paste, plus the arrow keys and the delete key to do all this. Make sure you don’t change anything else, and make sure you keep the quotation marks around the RSS feed address. Once that’s done, type Ctrl-O, then Enter to confirm, to save the changes. Then type Ctrl-X to exit the text editor. Then type the following to give your new script permission to run:

chmod 755 ~/Library/Scripts/get_Flickr_faves.sh

You can now run the script once to download your Flickr favourites:

~/Library/Scripts/get_Flickr_faves.sh

Hopefully that won’t produce any errors, and if you go into Finder to look in the “Flickr_faves” folder in your Pictures folder, you should see local copies of your Flickr favourites in there.

Tell your Mac to update the images once per day

Next we need to tell your Mac to run the script we just created once a day in order to update the images from your favourites on Flickr. So, run the following command:

nano ~/Library/LaunchAgents/uk.co.mattbrock.Flickr_faves.plist

This will again bring you into a text editor. This time, paste in the following:

<?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>get_Flickr_faves</string>
  <key>Program</key>
  <string>/Users/USERNAME/Library/Scripts/get_Flickr_faves.sh</string>
  <key>StartCalendarInterval</key>
  <dict>
    <key>Minute</key>
    <integer>15</integer>
    <key>Hour</key>
    <integer>15</integer>
  </dict>
  <key>Debug</key>
  <true/>
  <key>AbandonProcessGroup</key>
  <true/>
</dict>
</plist>

N.B. This assumes that your home directory is in /Users. If you’ve moved your home directory then you’ll need to alter the Program string to point to the alternative location instead of /Users/USERNAME. If you don’t know what this means then ignore it because it almost certainly doesn’t apply to you.

Replace USERNAME with your short username, then type Ctrl-O, Enter, then Ctrl-X to save and exit the editor. This is a set of instructions to tell your Mac to run the script we created earlier once a day in order to make sure your Flickr favourites are kept up to date locally. In order to get your Mac to read and act upon these instructions, we need to run the following:

launchctl load ~/Library/LaunchAgents/uk.co.mattbrock.Flickr_faves.plist

Hopefully that won’t produce any errors. We’re almost there now.

Configure the screensaver on your Mac

So all we need to do now is point the slideshow screensaver at the folder we created earlier to store the images from your Flickr favourites. Go into Desktop & Screen Saver in your System Preferences, click the Screen Saver tab, then choose one of the Slideshows (I prefer “Classic”), then under “Source” choose “Choose Folder…”, then navigate to the Flickr_faves folder in your Pictures folder. It’s up to you whether you choose “Shuffle slide order” – personally I prefer to have that on, as I like a bit of randomness. Then choose a time under “Start after” to determine how soon you’d like the screensaver to start up. Alternatively/additionally, you can click Hot Corners and choose a hot corner to trigger your new screensaver on demand. And that should be it! If all has gone well, your screensaver will now show you all your latest Flickr favourites. Enjoy.

Troubleshooting

You should be able to see the results of this automated script by launching Terminal and then typing:

grep get_Flickr_faves /var/log/system.log

This should show you the times when the task has run and what happened when it tried. When it’s been successful you will see something like the following:

Sep  4 15:17:56 mymac me[27308]: get_Flickr_faves: completed; 37 images

P.S. You can now get the Bash script and launchd XML configuration from GitHub if you so desire.