Create finder tag from command line

As of now the only way to create the Finder tag is from Finder preferences. I have a requirement to create the Finder tags programmatically either from Swift or from the shell script. I got the command to set the tag for any file. But did not find any option to create the custom tag from command line/swift

So, to clarify, you’re not asking how to apply to a tag to an item but rather how to create an entirely new tag?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Correct.

Have you looked at the .tagNamesKey URL property? It’s listed as being read/write, but I’ve not actually tried using it to set entirely new tags.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Create finder tag from command line
 
 
Q