06/28/13 00:40:00

Convert OpenMeta to OS X Mavericks Tags With This Script

Personally I’m not a huge tag user, but if I decide to use something, I use it very mindfully. I decided to use tags for a very particular thing on my computer: invoices. Having seen tags being implemented by Apple now, made me very excited. It took only a Google search to find out that Apple chose to use xattr for their tag implementation[1]. I quickly wanted to have something to convert my OpenMeta tags over to OS X tags, so I cobbled together this script. You might want to first try this script with a test folder.

It is very limited and might not suit your own workflow. It is released under under Creative Commons ShareAlike. Feel free to contribute your modifications.

Note that your OpenMeta tags will stay intact.

Thanks to Stack Overflow, aforementioned Google discussion, and Mac OS X Hints this was not nearly as difficult as I first thought it would be.


You need a working OpenMeta binary. You can download the latest from their Google project page. I chose to install mine under /usr/local/bin, if you decide to keep it somewhere else, change the script accordingly.

Secondly, you need to give this script a folder to work with. This is set in the $files variable. Please make sure NOT to type a trailing slash! This is very important. Otherwise your paths will look like this /Users/me/Desktop//example.pdf and this script will look very sad at you.

Third. I spent some time debugging this, but I only tested single-word tags and multi-word tags, which are surrounded by double quotes. If you know that your tags include some whacky characters like $, _, or !, this script might fail. Chances are it won’t. Just be aware of this sort of possible problem, which you might have to fix yourself.


You can find this script on GitHub.

  1. The technical detail here is that OpenMeta tags are implemented the same way, except the extended attribute is very tiny bit different. OpenMeta tags are implemented as kMDItemOMUserTags, whereas OS X tags are _kMDItemUserTags. Use xattr -p com.apple.metadata:kMDItemOMUserTags YOURFILE.PDF | xxd -r -p | plutil -convert xml1 -o - - to get either OpenMeta or Mavericks tags in human readable format. (-w writes a plist)  ↩