MacOS – Can’t add tag to apache config or log files

finder-tagmacos

In OS X X.9 Mavericks, I'd like to add a colored tag to my apache config file, which is under /private/etc/apache2, and to my apache log files, which are under /priavte/var/log

I do not have the option to add a colored tag to these files.

Is it because they are "hidden"? Or does it have to do with file ownership? Is there a workaround?

Best Answer

The files are owned by root and Finder runs as the user, so Finder is not allowed to modify the tags.

As a workaround, you can run Finder as root:

sudo /System/Library/CoreServices/Finder.app/Contents/MacOS/Finder

Or use tag or xattr:

brew install tag;sudo tag -s $'Red\n6' /etc/apache2/httpd.conf

sudo xattr -w com.apple.metadata:_kMDItemUserTags '("Red\n6")' /etc/apache2/httpd.conf;sudo xattr -wx com.apple.FinderInfo '00 00 00 00 00 00 00 00 00 0C 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00' /etc/apache2/httpd.conf