Apple - List all tags in Terminal in Mavericks?

You can also use tag:

tag -tgf \*|grep '^    '|cut -c5-|sort -u

tag -f \* finds all files with tags, -t includes tag names in the output, and -g prints each tag on a separate line.


The tags name are in ~/Library/Preferences/com.apple.finder.list.

You can read it with

defaults read com.apple.finder.plist ViewSettingsDictionary

It will need some parsing to be a bit clearer :

defaults read com.apple.finder.plist ViewSettingsDictionary | 
    awk 'NR%12==2'| grep -o '".*"' |  sed 's/^.\(.*\).\{18\}$/\1/'

Other possibility is parsing the plist as xml. To do that you'll need to first convert the plist from binary to xml using.

plutil -convert xml1 ~/Library/Preferences/com.apple.finder.plist


That list isn't comprehensive. It's only tags added through Finder. There's an additional file ~/Library/SyncedPreferences/com.apple.finder.plist, that also lists the tags that have been manipulated in Finder.

If you tagged a file in Terminal or using another tool and never manipulated the tags in Finder, then the tags won't be in either list.