logo pmbanner

A Miscellany of Mystifying Tiger Problems

By Francine Schwieder

Amazing Disappearing Drives, or The Invisibility Plague

 

The Vanishing Startup Drive

One day you start your computer and all seems normal, except you no longer see your hard drive icon on the Desktop. Your startup drive seems to have vanished from the Finder. You recheck your Finder preferences to make sure that the check box to show hard disks on the Desktop is still checked. They are. Just to make sure nothing has gone amiss with the preference file itself, you remove it:

/Users/yourname/Library/Preferences/com.apple.finder.plist

And then you reset the preferences from Finder again. You restart. Still no sign of the hard drive.

You access your home folder with no problem. You launch applications from the Dock, no problem. You can find things with Spotlight and open them. If you have used the Customize Toolbar option available in the Finder's View menu item to add the Path tool, and you are in your home folder when click on the Path tool you'll see a drop down menu showing all the steps to where you are, and you'll notice something odd: the listing for your hard drive appears rather greyed out compared to the other icons.

path

What has happened is that your drive has become invisible, and if you have one of the many utilities that allow you to show invisibles, you'll see your drive again when you turn that on, but you do not wish to see all the invisibles all the time. You just want to make your drive visible again. There are two ways to do this, one uses Applescript, and the other uses Terminal. Let's use Applescript first, as this is probably easiest for most Mac users.

Launch ScriptEditor and copy and paste this into the script window:

tell application "System Events"
set visible of disk "NameofDisk" to true
end tell

tell application "Finder" to quit
delay 1
tell application "Finder" to launch

Replace NameofDisk with the actual name of your disk, hit the Compile icon to make sure the script didn't acquire any errors, and then hit run. This should set the visible attribute back to visible and quit and relaunch the Finder, thus making the change available.

The same thing can happen to other drives, both internal and external. You can use the same Applescript to fix those as well, just put in the name of the drive.

path

If you prefer to use the Terminal, and have the Developer tools installed, you can use the GetFileInfo to check the visibility bit, and SetFile to change it. If you don't have them, you can download them HERE. If you have done Tiger updates you may already have the SetFile command in the Updater receipts packages. I have three copies, they are in the combo updates for 10.4.7 and .9, as well as the patch for .8, in the respective Resources folders. Look here, for instance:

/Library/Receipts/MacOSXUpdCombo10.4.9PPC.pkg/Contents/Resources/SetFile

Or to get it using the Finder, you would select the MacOSXUpdCombo10.4.9PPC.pkg and then Control click, select "Show Package Contents" the open the Contents folder, then the Resources folder, and retrieve the SetFile UNIX binary and put it somewhere sensible.

Unzip and either put the two commands somewhere in your PATH or, if you don't know how to do that, you can just drag and drop the command into the Terminal. So if you did that, you would do something like this in order to check the visibible attribute of a mounted drive:

bash:~yourname$ /Users/yourname/Desktop/setgetfile/GetFileInfo /Volumes/"NameOfDrive"/

Hit return and see what the Terminal reports. I have the commands in my PATH, so when I run the command on a partition I have named OXey, I get this:

bash:~francine$ GetFileInfo /Volumes/OXey/
directory: "/Volumes/OXey/"
attributes: aVbstClinmed
created: 08/05/2006 20:08:50
modified: 02/17/2007 12:00:10

The part you are interested in is the attributes. You'll see the second one is an upper case "V"--meaning it is invisible (I made it invisible for the purposes of this demonstration). To bring it back into view you use the SetFile command, with the attribute option and a lower case "v" to unset the invisible bit:

bash:~francine$ SetFile -a v /Volumes/OXey/

or yours would be something like this (again presuming SetFile isn't in your PATH, but was downloaded and unzipped on the Desktop):

bash:~yourname$ /Users/yourname/Desktop/setgetfile/SetFile -a v /Volumes/"NameOfDrive"/

You'll need to relaunch the Finder or log out and back in to see the change. You need to use the quotes around the drive name only if the name has an odd character or a space in it.

 

And Other Invisibles Too

It isn't just drives that can get the invisible bit set--folders can as well. Indeed, the first case I saw of the Invisiblity Plague was someone's Applications folder. This is easy to check and fix using the GetFileInfo and SetFile commands: you just enter the command and then the path to the folder. You can also see files and folders, visible or not, using the list command in Terminal, with the option for all set:

bash:~francine$ ls -al /

Hit Return and you will see the list of everything on your drive at the root level. If your Applications folder had gone invisible, you would use this (again presuming SetFile is in your PATH):

bash:~francine$ SetFile -a v /Applications/

You can use Applescript to check and reset the visible property of files and folders. Applescript handles the path a bit differently than UNIX, using a colon where UNIX uses a slash, or, even more awkardly, a verbal description of the path. To check the visible bit of a folder named screens sitting on my Desktop, I would use this script:

tell application "System Events"
get visible of folder "NoobiX:Users:francine:Desktop:screens"
display dialog ((the result) as string)
end tell

A little window will pop up with either true or false in it, and a button to click OK. If the window says false, then the folder is not visible, and the invisible bit has been set. You can use this Applescript to make it visible again:

tell application "System Events"
set visible of folder "NoobiX:Users:francine:Desktop:screens" to true
end tell

Thus, if your home Pictures folder had become invisible, you put in the name of your startup disk, then Users, then your shortname, and then Pictures. And of course the reverse will also work--if you want to make something invisible in the Finder use false instead of true. And to activate your change you need to restart the Finder, either from the Dock (by an option click on the Finder icon and selecting Relaunch) or by putting the command in the Applescript, as is done in drive script above.

Invisiblity and Leopard

Let's start with the bad news: it seems that it has become more common in Leopard, especially the business of the home folder vanishing (which previously was a fairly rare occurence), and in some cases it cannot be reliably fixed. Whatever the root cause of the problem promptly resets the visible bit to invisible. See, for instance, this lengthy thread in Apple Discussions:

Macintosh HD icon is not on my Desktop or visible from the Finder

Although Paul Laskin marked it solved, since he got his drive to be visible for all of 24 hours at one point, that turned out not to be the case. The problem is still unsolved, and Paul has submitted a bug report. I don't think the cause is known to the Apple engineers, since the problem first appeared in Tiger several years ago and has never been fixed at the source. The most that Apple has offered is the sort of bandaid correction that this article also applies, that is, reset the visible bit, not stop whatever bug is causing the bit to be changed to start with. What was an occasional annoyance, easily corrected in Tiger, seems to have become an unsolveable problem for some systems in Leopard.

Apple has recognized the problem of the home folder becoming invisible and has a new Knowledge Base Article giving a brand new Terminal command to fix it. This brings us to the good news: in Leopard the change flags (chflags) command has been modified so that it now will set a Finder "hidden" flag (and unset it too, of course), as it will change the visible bit. The command can be used on drives and folders, and is available whether you have installed Developer Tools or not. Thus to change the hidden flag, or set the invisible bit back to visible on your home folder, you would issue this command:

chflags nohidden /Users/yourshortname

More good news: you don't even need to restart the Finder. The change is recognized and acted upon immediately. However, there are reports that using Windows in Parallels and accessing a file in the home directory from a Windows program instantly causes the home directory to become invisible again. If this happens to you be sure to check the Parallels web site to see if there is a fix.

When it comes to drives the situation is more complex in Leopard than in Tiger. For instance, the drive may get the invisible bit set and disappear from the Desktop, the Computer section of a Finder window, but still be present in the Sidebar. Also, depending on the drive, it may be necessary to issue commands to change things using a "super user do" (sudo) command. Here's the command for a drive:

sudo chflags nohidden /Volumes/"NameOfDrive"

And here's the command if your startup drive is the one afflicted:

sudo chflags nohidden /

Depending on how you have your Terminal prefs set, your command prompt may look different than mine. I have mine set at the moment to show the Computer Name as set in the Sharing preference, my location, and of course my user name, so this is what my prompt and the commands shown above actually look like for my own home folder, for a drive named LeoUp, and for the startup drive:

NoobiX:~ francine$ chflags nohidden /Users/francine
NoobiX:~ francine$ sudo chflags nohidden /Volumes/LeoUp
Password:
NoobiX:~ francine$ sudo chflags nohidden /
Password:

When the Password prompt appears, type your admin password. It is not echoed to the screen in any way whatsoever, so type carefully and hit the Return key again.

 

Invisiblity and Spotlight in Leopard

In many cases where the invisible bit gets reset, the cause is a series of bugs involving Spotlight. Things appear fine until you add or modify some files and Spotlight runs. Next time you restart the drive is again invisible. It seems that the culprit is often (perhaps always) that the drive in question has had a comment added to it in the GetInfo window's Spotlight Comments field. Removing the comment, even removing the invisible .DS_Store file where such comments are generally stored, does not fix the problem.

The key is the metadata attribute, and the new Apple arbitrarily extensible attribute system. Evidently, when it comes to drives (although not files) setting the kMDItemFinderComment attribute by adding a comment in the GetInfo comment box causes Spotlight to reset the visible bit to invisible when it runs (that's a bug). Deleting the comment from the GetInfo box, and even removing the associated .DS_Store file, does not remove the attribute (it may merely change its value, but the attribute is still present; this strikes me as being a bug also). To see if this applies to you, run a list command for the affected drive and request that it include a list of extended attributes:

NoobiX:~ francine$ ls -al@ /Volumes/LeoUp
total 42440
drwxrwxr-t@ 38 root admin 1360 Jan 10 23:49 .
   com.apple.FinderInfo 32
   com.apple.metadata:kMDItemFinderComment 42
drwxrwxrwt@ 6 root admin 204 Jan 10 22:50 ..
(and so on)....

As mentioned earlier, LeoUp is the name of my afflicted drive. If the drive you are having trouble with is your startup drive you would end the command at /. If you see com.apple.metadata:kMDItemFinderComment in the results returned, then you do indeed have this problem. Begin by using one of the methods described above to make the drive visible again, then do GetInfo on the drive and delete the Spotlight comment. For luck you might also remove the .DS_Store file, or at least rearrange the view so that the .DS_Store file gets updated. Next it is time to tackle the metadata entry using the new xattr command.

While the xattr command allows one to do a minimal amount of work with extended attributes, unfortunately there is virtually no information about it, not even a man page. You can get Terminal to print out some information by asking for the help entry of the command:

xattr --help

This gets you a tiny bit of information. The important bit is that the -d option will delete the attribute you name.

So what I did was to change directory into my LeoUp drive, using the cd command, and then ran the xattr command with the delete option on the offending metadata entry:

NoobiX:/ francine$ cd /Volumes/LeoUp

NoobiX:LeoUp francine$ xattr -d com.apple.metadata:kMDItemFinderComment .

(NOTE the presence of a space and a . "dot" at the end of the command!)

It should also work in this form:

NoobiX:/ francine$ xattr -d com.apple.metadata:kMDItemFinderComment /Volumes/NameOfVolume

If you haven't done so already, reset the visible bit. It should now behave correctly. Anyway, it worked for me and several other people with the problem.

In summary, the good news is that in Leopard you can use the Applescript, the SetFile command or the new chflags command to bring drives and folders back to visiblity in the Finder. The bad new is that for some people whatever is causing the problem may reset the bit back to invisible. If that happens to you, check the attributes using the list command. If you have added a comment to the drive, the above procedure should fix it. If that is not the case, you can always make an alias to an invisible item and use the alias to open it.

1. In Terminal issue the command to open the item; thus if what is invisible is your startup drive, you would give this command (the command, a space, then the path to the item and hit return):

open /

2. The invisible item will open in a Finder window, and you will notice that its name with a small proxy icon shows in the window's top toolbar.

3. Hold down the Option and Command keys, click and hold the little proxy icon in the Finder window's toolbar and drag it to the Desktop--there will be a little curvy alias sign on your cursor if you are doing it right--and when you see the drive's name and the curvy alias arrow on the Desktop release the mouse button.

You'll then have an alias to the startup drive on the Desktop that you can double click to open the drive and see its contents, just like always.


Return to Index

Next: All Too Visible