Control auto-opening windows on mounted Volumes

Dec 24, '09 07:30:03AM

Contributed by: poenn

I think that most of you know that some volumes, like the OS X Install DVD or downloaded disk images, automatically open a Finder window when mounted. I use an external FireWire drive with lots of different partitions on it, and one of them holds a clone of the OS X Install DVD for faster installations. Since it's cloned, it acts the same way as the DVD: it auto-opens in the Finder.

After quite some time, I got annoyed by this enough to seek a solution -- I didn't want to see this window every time I connected the drive. So I asked on the forums here for help, and user biovizier pointed me in the right direction. Thanks!

It turns out that the bless command specifies which folder to open when a volume is mounted. From the manpage of bless:

--openfolder directory Specify a folder to be opened in the Finder when the volume is mounted by the system.

So I first tried changing the current setting to another existing folder via:

sudo bless -folder "/Volumes/Mac OS X Install DVD" -openfolder "/Volumes/Mac OS X Install DVD/var"

After unmounting and remounting the volume, the Finder automatically displayed the var folder this time. You can't specify a nonexistent folder, so I went ahead and created dummy inside of tmp on the Install DVD partition, and then issued this command:

sudo bless -folder "/Volumes/Mac OS X Install DVD" -openfolder "/Volumes/Mac OS X Install DVD/tmp/dummy"

Afterwards, I simply deleted the dummy folder, and now the auto-opening is gone! In addition, I now know what to do if I ever need the opposite behavior. Any improvements to this method are welcome!

Comments (3)


Mac OS X Hints
http://hints.macworld.com/article.php?story=2009121606541533