How can I add OS X “tags” to files programmatically?
问题 Since Mavericks, OS X has had the ability to tag & colour files in Finder. Is there any way to add tags to files through Cocoa APIs or via a shell command? 回答1: Sorry for adding another answer, but the one related to setting Label colors was pretty long already. Here is an excerpt from a python script that I use to set the User Tags. It seems to work to make things searchable, but not sure if the tags will show up correctly. Usage is basically: tagfile.py "Tag Name" FileOrFolderName Code