title: Detecting process instances in Mac OS X
body: <p>I'm trying to implement a way to detect whether another instance of an application has already been started, and have been tinkering with:
  1. Shared memory
  2. Named mutexes
  3. Named pipes</p>
  
  <p>Seems all of these have the flaw that if the "main" application crashes, the "IPC" object will be left hanging making all future instances of the application think that there is another instance active (until a reboot). Ideally I'd like to have an object that is automatically removed when the process is terminated, whether normally or by a crash.</p>
  
  <p>Ideas?</p>