published on

UnmountService

Services are a means in Mac OS X for the user to pass small pieces of data out of one application to another. The pieces of data may be snippets of text, images or files. Applications can publish Services that accept certain types of data, and these Services can be passed data out of almost any other Mac application.

In Snow Leopard, the role of Services has been expanded somewhat; they can now be accessed through the context menu of items they support. This means I can right-click on a file in the Finder, and get a context menu option “Send File To Bluetooth Device” which is a Service which can be sent files, published by the Bluetooth File Exchange utility. This application does the same kind of thing – it publishes a Service which can be sent volumes and attempts to unmount them.

You can download the service, unzip, and place in your /Library/Services folder. Finder should pick it up and then, when you right-click on a volume’s icon on the Desktop, you should see an “Unmount” option in the context menu. The source code can also be downloaded, it is pretty straightforward and could provide an example for developers of other simple services.