Invisibility and Metadata
I normally avoid anything that looks like tech support in my entries here, but this may verge on an exception. Bear with me, and I’ll explain.
I rebooted my Macbook Pro about four days ago, and lo, to my surprise, the icon for my boot drive had vanished. I was, too say the least, slightly perturbed. (To the right, the culprit.)
I tried all the quick-fix things - changed what showed in Finder, tried to get it back through Finder - it was gone there too - and finally, I sucked it up and called Apple. Three calls to Apple - and two instances of being hung up on - a clean install of Leopard, and multitudinous Google searches later, I had found two things: a lot of other people were having these issues, all starting about the same time as mine, and, more importantly, a solution.
So first, the solution, and then the explanation of what it is, what it does, and what that means for all of us Mac users.
To get your startup drive back, you need to run two Terminal commands. One of them requires that you have an Administrator password. I’d generally try to give you a solution that didn’t require Terminal, given some peoples’ squishiness about that, but I can’t find another frontend to this. (There’s an Applescript running around, but it doesn’t work, really.)
First, run xattr -d com.apple.metadata:kMDItemFinderComment /***
In this case the *** signifies the name of your missing drive, as this command will work for any drive. If you want your startup drive, all you need is the slash.
Next, run sudo chflags nohidden /*** Same deal with the asterisks, though in this case, another important modification is that it doesn’t need to be run as sudo unless you’re running it on your root drive.
Log out and/or restart, and your icon should be back to stay.
Now, what that all means. As it turns out, the culprit in all this is a simple metadata flag, the hidden flag. This is the same flag that hides the .DS_store files and other things that you’d rather not see floating about your operating system all the time. The problem, in this case, is a change in how Leopard handles that flag, and metadata in general.
Leopard marks a very interesting shift in how Apple’s chosen to deal with the increasing amounts of complicated metadata that we’re all generating. In past years, this has been stored in .DS_store files, for the most part. Tiger added the xattr function family and API’s to play with some, and some people, namely Marquis Logan and John Siracusa, then wrote up some nice little tools that made this accessible to all of us.
In Leopard, there is now a native command for this. There are four flags to the xattr command, at least so far as I’ve been able to tell. (There is no man page for this, but -h works.) They are -l, -p, -w, and -d, and all of them are written out as xattr -flag file [file path]. -L lists the names of all extended attributes on the file. -P, used with -l, prints them. -W is written out as xattr -w attribute_name attribute_value file [file path], and changes the chosen value to whatever you specify. -D, the important one for the above command, simply deletes all extended attributes. The first command, then, deletes all the extended attributes on the given file. The com.apple.metadata.kMDItemFinderComment contains, among other things, the flags for drives in Finder.
The second command, the chflags command, resets the hidden flag on the given file. Two different methods of getting at two different types of metadata, in essence. The second command is found in a couple of places if you google this, but it by itself doesn’t keep the job done. Without the xattr command, the hidden flag resets every time Finder does.
Now, how this happens? I don’t know. I’m working on that - but I suspect that Apple may be too. And in the meantime, I’ve already found some neat things people are doing with it now. Anyone for a way to kill that annoying ‘this program has been downloaded from the internet’ message?


#1 robertl says:I had the exact same problem with my brand new iMac. I was about to completely reinstall Leopard and restore my configurations from Time Machine when I read your piece. Thank You, thank you, thank you!!!!!!! Tech support wasn’t quite sure what to do.
Your solution worked like a charm!!!!!!

#2 dorianN says:I have the problem you described. My missing hard drive icon is for an external hard drive connected directly to my Mac Pro with by firewire 800 cable. I had an icon for this drive on my desktop and it worked fine. Several programs had files I had created and saved to it, and even when the icon vanished from the Finder, the progams could still open those files from the File>Open Recent menu so I know the drive is working.
I tried the solution suggested. I got the name of the drive from Disk Utility just to be sure I had the name right. It didn’t work.
The first line to type into Terminal that you specified returns “No such File: /Volumes/fred”
I tried it several times with variations like: /fred and even “/LaCie/fred” all with the same no such file response.
Am I missing something? this is the first time I have used Terminal and I only switched to Mac 2 months ago so something simple could trip me up.
Any advice welcome.

#3 Stephanie Guertin says:@DorianN - Can you navigate to the drive in the Go menu via that drive name? If not, you may have a different problem. Also, is the drive HFS or FAT32? I only know that this works with HFS drives, and it may not with FAT32 - though the (limited) info available on this doesn’t mention any difference there, I can’t make any guarantees that there’s not.
@robertl - Very happy to hear that it helped.

#4 dorianN says:I can’t navigate to the drive using the Go menu. The drive name is not there. The drive is present for programs that have recently saved files to that drive using File>Recent and it is present in the Disk Utility app, no where else.
The drive is listed in Disk Utility as Journaled HFS Plus volume.
it also says the “The volume appears to be OK” when I run verify disk.
I am new to Mac so I may be missing something obvious. Your help is appreciated.

#5 Jack Mottram says:I’m having the same problem, but when I try to run the first command above, with just a slash for my startup drive, I get:
“No such xattr: com.apple.metadata:kMDItemFinderComment”
If I explicitly name the drive, I get:
“No such file: /Macintosh HD”
Any ideas?

#6 Stephanie Guertin says:@Jack - with that space in there, you need to phrase it as /Volumes/Macintosh\ HD to indicate the space. Let me know how that works.
@DorianN - if it’s really your metadata that’s to blame, the drive should still come up in the Go menu. I’m honestly not sure what your drive is doing - why don’t you try our forums? There’s some very smart people in there that may be of more help to you.

#7 Quackerz says:This isn’t specific to Leopard, it happened to me in Tiger as well.

#8 dorianN says:And the saga continues.
While poking around I discovered that If I click the Apple in the menu bar and select Recent Items in the section labeled Servers there are 2 listings for fred, one opens the external hard drive and shows the files, the other gives a Connection failed.
Also, there are 2 listings called LaCie (which is the brand of hd I have) the first one does nothing, no error message or anything else. The second LaCie gives the connection failed error message.
I selected the first fred and it opened the finder window with the folder that contains files i want access to. I made an alias of it and put it on my desktop and now that works as access to fred.
Too weird. It sure seems like a hidden icon problem to me but I cant get the Terminal commands to work for me.
Thanks for taking the time to answer me. I will try the discussions and see what i find.

#9 Matt Lye says:Hi Stephanie,
The version of xattr that ships with Leopard is a python script that calls a library (python ‘egg’) written by Bob Ippolito, and distributed under the MIT license. You’re mostly right about the commands, except that ‘-l’ is actually “long”; xattr lists the names of the extended attributes attached to the file by default, in the absence of a flag.
Bob’s source code can be found here. In the unlikely event that one needs to run xattr from a loop in a shell script, I would recommend using Marquis Logans’s version from Darwin Ports, my version from Sourceforge, adapting the source code from one of the BSD *nix distributions, or rolling your own. Otherwise, the python run-time system gets loaded every iteration.
The version numbers of the three versions (0.4, 0.3, and 0.1, respectively) are completely unrelated. (Helpful, I know). My version is the work of an inexperienced hobbyist, but should be a drop-in replacement for Bob’s as far as command syntax goes.