resolveSimulatorAppPath static method

String? resolveSimulatorAppPath({
  1. required String? developerPath,
  2. required bool exists(
    1. String path
    ),
})

Prefer DeviceHub.app (Xcode 27+), then Simulator.app.

developerPath is xcode-select -p (for example /Applications/Xcode.app/Contents/Developer).

Implementation

static String? resolveSimulatorAppPath({
  required String? developerPath,
  required bool Function(String path) exists,
}) {
  if (developerPath == null || developerPath.isEmpty) return null;
  final deviceHub = p.posix.join(
    p.posix.dirname(developerPath),
    'Applications',
    'DeviceHub.app',
  );
  if (exists(deviceHub)) return deviceHub;
  final simulator = p.posix.join(
    developerPath,
    'Applications',
    'Simulator.app',
  );
  if (exists(simulator)) return simulator;
  return null;
}