Bottom line: Run this command in Terminal to copy your photos from an iDevice to your Mac via SSH.
I really wish there was a Skitch for iPhone, but it doesn’t exist (although the iPad version is nice). That means that adding arrows or text or whatever minor adjustments to a picture usually means opening up the pic on my Macbook.
There are many easy options to get the pic there, but not very many fast ones. Since my iPhone is jailbroken, I decided to figure out how to make this happen with an SSH script today. Ends up it was pretty easy and works much more quickly than waiting for Photo Stream or Cyberduck and doesn’t require me to connect a cable like iFunBox or iPhoto (since iPhoto is such a lightweight, fast-starting application that I’m dying to use it anyway).
For this tip to be of the greatest convenience, you’ll probably want to use some kind of text expansion (I put it in TextExpander and set it to only expand in Terminal), and you’ll probably want to be set up for password-less / public key SSH authentication for your jailbroken iDevice.
I’m no pro with Terminal, so if you have recommendations on how I should improve this, please let me know in the comments. I’ll break down my script piece by piece.
- scp “Secure copy,” a way to copy things over an SSH connection.
- -r “Recursive,” copy the folder and everything inside
- -i “Identify_file,” manually choose which SSH private key to authenticate with, only needed if you have multiple separate keys
- ~/.ssh/mykey_id_rsa The location of my private SSH key
- email@example.com Authenticate as root. You can use a static IP address instead of a bonjour name.
- : Identifies the “remote” file.
- /User/Media/DCIM Path to DCIM folder on the iPhone, should be the same for your device.
- /Users/username/Desktop/%Y%m%d\ Phone\ Pics/ Full path to the local location where I want to place the pics, including the folder name.
I decided to copy the whole DCIM folder because I’ve occasionally noticed multiple internal folders, and I’m not sure when or why they’re created, but I want to get all of them. Also notice the
%Y%m%d to put the YYYYMMDD date into the folder name, making it much less likely for me to overwrite any preexisting folders, and the “escaped” spaces in the path. Make sure to insert your own username, obviously.
So the full line is this:
All I have to do is make sure the phone is awake or connected to power (so its SSH daemon will work), crank up the sprightly Terminal, and type in my TextExpander snippet “ppictures”, and the end result is a datestamped folder of all my iPhone pics on my desktop.
To make things even faster, I could set this whole thing up as a Quicksilver trigger or a shell script, but then I wouldn’t get the nicely formatted datestamp that TextExpander puts in for me. Then again, I bet there’s a way to do that with Terminal… I just don’t know how.