Ask Different is a question and answer site for power users of Apple hardware and software. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have an external drive. Is it possible to launch a program or perform an action when I connect it or plug it in?

share|improve this question
up vote 4 down vote accepted

Marco Polo can perform actions (you specify) based on attached USB devices.

Edit: MarcoPolo isn't supported anymore, but there is a maintained fork of it: ControlPlane

share|improve this answer
Thank, it works! Steps to configure Marco Polo: (1) Create a context, e.g. DTVP (2) Plug the drive, create a USB rule for this context and increase its confidence to 100% (3) Setup an Open action for /Volumes/DTVP/Mac/ Voilà! – pesche Jan 5 '11 at 22:07

The likely most robust solution is to create a launchd job with the StartOnMount property set to -boolean YES:

StartOnMount <boolean>
This optional key causes the job to be started every time a filesystem is mounted.

This is how Time Machine does it (see /System/Library/LaunchDaemons/

You need to check if the desired /Volume/... is available, but in my experience, it's faster than using Folder Actions.

share|improve this answer
Here's is an interesting link about launchd approach: – Somebody still uses you MS-DOS Oct 10 '11 at 6:27

A similar question has been posted in the MacRumors forum here:

The specific suggestion there is to use the application MarcoPolo.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.