How can I remove Finder tags from all files in a given folder and in its subfolders?

  • I wish I had an answer, I'm curious as well. If you're handy with the shell then the mdfind command may be part of your solution in the end. Good luck. May 12, 2014 at 20:16

2 Answers 2


You can use Homebrew's tag:

brew install tag
tag -r /path/*

You can combine this with a find command to find specific files/folders + recursive.

find . -exec tag -r {} \;  -print
  • How does one go about using the last line of code on a directory? I don't want to screw up and remove tags from every folder in my system: find . -exec tag -r /path/ {} \; -print. Furthermore, can I just cd to a directory and perform that command?
    – JDev
    Apr 15, 2017 at 15:06
  • @Matt The find command has two components: the path/filter and the action. find . will use the current directory that you've cd'd to, or you can use find /path/to/folder and specify the path there. No filter is given so every file and folder beneath the given path will match. -exec …; will execute the command, replacing {} with each matched path. -print also prints the matching paths. You can ‘dry run’ the command by removing the ‘exec’ and just using find . -print (which is equivalent to find .), which will print the list of files matched without doing anything else to them.
    – grg
    Apr 15, 2017 at 15:18
  • @grg Find is very slow and this command did not remove any tags from my files. Can't we use tag's find files with tags command and then pipe that to xargs? tag --match '*' --recursive --tags /path/to/folder | xargs -0 -r tags '*' {} .I am having trouble with the syntax. Help
    – John
    Sep 11, 2020 at 4:36
  • It seems that the tag app doesn't actually remove com.apple.metadata:_kMDItemUserTags from the file/folder. It leaves it behind.
    – John
    Oct 13, 2020 at 20:31

You can also use xattr:

xattr -dr com.apple.metadata:_kMDItemUserTags ~/folder
xattr -dr com.apple.FinderInfo ~/folder

If you don't delete the com.apple.FinderInfo extended attributes, Finder keeps showing the color labels for tags with colors. If you don't want to keep any extended attributes, you can just run xattr -cr ~/folder.

You can use find -xattrname or mdfind to find files with tags:

find ~/folder -xattrname com.apple.metadata:_kMDItemUserTags
mdfind -onlyin ~/folder kMDItemUserTags=\*

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .