Disappearing color labels in Mac OS X

Had a tiny fight with Mac OS X the other day, like I often do. This time it was color labels. You probably know (if you have used Mac OS X at all) that you can color label your files. You simply right-click them in the Finder and select a color label.

This can be quite a handy feature, but not so much when it doesn’t work. My problem was that I would give a bunch of files color labels, but then shortly after that the label simply disappeared. I could look at the file in the Finder, it had its label, I’d click on it, and the label disappeared. In fact the color label was already gone, it was just that the Finder is kind of slow to update itself (O’ how I miss F5 sometimes…).

You can check if a file really has a label or not by opening up a Terminal and using the following command on the file in question:

$ mdls -name kMDItemFSLabel somefile.ext

It will give you back a number and if the number is greater than zero it means the file has a label.

Either way, after some digging I found that it might have to do with some XSan issues or corrupt meta files. Mac OS X spreads these meta-files around wherever it goes and apparently they go corrupt from time to time. The way to fix this issue (and perhaps others?) is to clear them out and let them be recreated. As these files are hidden in the Finder, and Mac OS X is so kind to not give us an easy way of showing hidden files, I once again opened up a Terminal. I then went to the directory with the broken meta-files and ran these two commands:

$ rm ._*
$ rm .DS_Store

You then visit the folder in Finder and all labels should be gone. Re-label them, and you should be back to normal. Hope this can help someone else :)

Note: If you want to do this recursively in a directory, you can run this:

$ find . -name .DS_Store -delete
$ find . -name "._*" -delete

Note: If you have files without an extension, like some video instead of somevideo.mov, Finder won’t know how to open these files anymore after you remove the meta-files. If that happens I recommend you either stick the correct extension on the file, or you right-click the files, select Get Info, and then under the Open with category select the application you want the file to be opened with. (But seriously, just giving the files proper extensions to begin with is a lot easier to work with… at least I think so…)

This entry was posted in Technology and tagged , . Bookmark the permalink.

3 Responses to Disappearing color labels in Mac OS X

  1. I’ve had quite the same issue with files hosted on a time capsule.
    I would label them with the finder, the label would appear, and the moment after, disappear without further notice ….

    I did not know about mdls, thanks !!!, and it confirmed that the file had kept the color label, but it was the finder whom did not display correct info.

    I just re-launched the finder and I saw my labels again !

    Looks like the finder has some issues with color labels on remotely hosted files ….

  2. Richard says:

    Your solution worked for me. Thanks!

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>