Compressing Your Shortcuts

If you are using the new Shortcuts app for iOS 12, hopefully you are backing up your shortcuts. It’s pretty easy to do. You basically only need 3 steps:

  1. Get My Shortcuts
  2. Make Archive
  3. Either “Save File” (which will allow to to save to iCloud, Dropbox, etc) or “Send Email”1

Step 2 is really the key. Assuming that you use some variation of “Current Date” in the “Archive Name” you can easily keep multiple backups, which are good in case you accidentally delete a shortcut, or change something and realize you liked it better the old way. (It’s not so easy to “Undo” changes to shortcuts!)

I was rather pleasantly surprised to see that the “Make Archive” action has a lot of formats to choose from, including .zip, .tar.gz, .tar.bz2, and .tar.xz. You could also just use .tar if you’re some kind of weirdo who doesn’t use compression when backing up a bunch of text files.

sigh Now that I said it, you’re actually thinking about just using .tar, aren’t you? Well, I guess I can’t stop you, if that’s what you really want to do.

I was curious to see what difference the various compression algorithms would make when backing up my shortcuts. Of course this will vary greatly depending on how many shortcuts you have, and how complicated they are. I mean, if you’re some sort of crazy person who base64-encodes images of Apple products into a shortcut, then your shortcuts archive will probably be much bigger than mine. 2

Anyway, here are the relative sizes (in bytes) of my backups, sorted by size (and yes, I included .tar just so you could see how it would compare to the others):

3305984 - Shortcuts-Backup-2018-10-25--02.10.tar
2180398 -
2115498 - Shortcuts-Backup-2018-10-25--02.06.tar.gz
2105331 - Shortcuts-Backup-2018-10-25--02.05.tar.bz2
1059304 - Shortcuts-Backup-2018-10-25--02.02.tar.xz

You can see there‘s a negligible difference between .zip / .tar.gz / .tar.bz2. Really the only significant difference size-wise is between .tar.xz and everything else. Given that .tar.xz. shows a significant reduction in size, you’d probably expect me to recommend that you use .tar.xz for your Shortcuts backups.

But you’d be wrong.

Cue Dramatic “Plot Twist” Music!

I stopped using .tar.xz and would caution others to do the same, because I happened to test unarchiving one of my Shortcut backups on my Mac.

As you may know, the Mac’s “Archive Utility” does not handle .tar.xz files very well. The Unarchiver can, and I usually recommend it for folks who want to use .tar.xz on the Mac.

However, Archive Utility is not the reason I would suggest avoiding .tar.xz for backing up your Shortcuts. In fact, I would suggest avoiding .tar.bz2 and tar.gz and even plain ol’ .tar (and not just because not using any compression at all just strikes me as weirdly defiant).

TurnsOut™ there is a bug in the “Make Archive” feature in Shortcuts with any archive format which involves ‘tar’ if your shortcut names include emoji.

I have several shortcuts which include emoji in the names, since emoji are handy for visually identifying shortcuts in a list, and using emoji can also help make shortcut titles shorter. For example, shortcuts which involve anything related to my car include the 🚗 emoji, and it’s proven to be very useful in quickly identifying them in the list.

Trying to unarchive my shortcuts backups caused The Unarchiver to freak out, asking me to tell it what character set I had used. (It showed me a truly impressive list of possible choices, but none of them properly decoded the emoji.)

Undaunted, I manually ran unxz on the .tar.xz file and then opened the .tar file with Archive Utility, which didn’t prompt me to choose a character set… but mangled all of the emoji in all of the file names.

The same thing happened when I tried .tar.bz2, .tar.gz, and even just .tar. In every case, The Unarchiver couldn’t deal with it, and Archive Utility mangled the emoji characters.

The only emoji-safe option? Good ol’ .zip.

So although it’s not the most efficient compression method available, I think .zip is the best choice. Or you could not use emoji in your shortcut names… if that’s the sort of life you really want to lead.


By the way, if you’re looking for a Shortcuts Backup shortcut that will save to iCloud, Dropbox, etc. you can use Shortcuts Backup, which is part of the Shortcuts Archive at MacStories . You’ll be pleased to know that it uses .zip, too. You can easily modify it to send your .zip file via email if desired.

  1. You could also do both email your backup and save it to cloud storage, if you wanted to make sure you had at least 2 copies. Personally, I do both, but I do it in one step. My secret weapon is, a free service which will assign you a unique email address you can use to – you guessed it – send attachments to Dropbox. The reason I prefer that method is that I get two backups: one in my email‘s “Sent” folder, and another on Dropbox, but I only have to use one step in the shortcut. Also, I can write myself a little note in the email compose window to remind myself what changed since the last backup. Those messages act similarly to “commit” messages in git, although a lot less formal. I can write something like “Changed Backup Shortcuts” and if I’m looking through my backups later, I will know what changed in this backup compared to another.  ↩

  2. Uncompressed, Federico Viticci's Apple Frames shortcut is 10+ MB all by itself.  ↩