code: public void removeStaleSimulatorLaunchds() {
  
      // The instruments crashes sometimes by throwing the following error in the logs
      // The below logs were taken from Xcode5.1.1
      // sim[2430:303] Multiple instances of launchd_sim detected, using com.apple.iphonesimulator.launchd.3bd855a 
      // instead of com.apple.iphonesimulator.launchd.59ef76ee.
      List<String> launchctlCmd = Arrays.asList("launchctl", "list");
      Command cmd = new Command(launchctlCmd, false);
      SimulatorLaunchd simLaunchd = new SimulatorLaunchd();
      cmd.registerListener(simLaunchd);
      cmd.executeAndWait(true);
  
      // Retrieve the stale iphonesimulator launch IDs
      Set<String> simIDs = simLaunchd.getLaunchdIDs();
      if (simIDs.size() > 0) {
        if (log.isLoggable(Level.FINE)) {
          log.log(Level.FINE, "Removing stale iphonesimulator launchds: " + simIDs);
        }
        String iphoneSimulatorPrefix = "com.apple.iphonesimulator.launchd.";
        for (String id : simIDs) {
          launchctlCmd = Arrays.asList("launchctl", "remove", iphoneSimulatorPrefix + id);
          cmd = new Command(launchctlCmd, false);
          cmd.executeAndWait(true);
        }
      }
    }
docs: Removes stale iphonesimulator launchds hanging in the system