simctl - Xcode Simulator Utility Wrapper

3.0.0 · active · verified Sun Apr 19

The `simctl` library provides a Node.js-based programmatic interface for interacting with Apple's `simctl` command-line utility, which manages iOS Simulators on macOS. It enables developers to automate tasks such as listing available devices, booting simulators, installing and launching applications, and interacting with device settings directly from JavaScript or TypeScript code. The current stable version is 3.0.0, which introduced significant breaking changes related to output handling and method signatures. The project's release cadence is driven by updates to Xcode and internal improvements, rather than a fixed schedule. `simctl` is designed for Xcode 8 or greater and Node.js 14.17.0 or greater, acting as a foundational component for other iOS development tools like `ios-sim` by abstracting complex `xcrun simctl` commands into a more accessible API.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart code demonstrates how to use the `list` function from `simctl` to asynchronously retrieve and display information about all available iOS Simulator devices, runtimes, and device types configured on the macOS system.

import { list } from 'simctl';

async function getSimulatorInfo() {
  console.log('Fetching available Simulators and runtimes...');
  try {
    const info = await list();
    console.log('Devices:');
    for (const runtimeId in info.devices) {
      console.log(`  Runtime: ${runtimeId}`);
      info.devices[runtimeId].forEach(device => {
        console.log(`    - ${device.name} (${device.udid}) - ${device.state}`);
      });
    }

    console.log('\nRuntimes:');
    info.runtimes.forEach(runtime => {
      console.log(`  - ${runtime.name} (${runtime.identifier})`);
    });

    console.log('\nDevice Types:');
    info.devicetypes.forEach(type => {
      console.log(`  - ${type.name} (${type.identifier})`);
    });

  } catch (error) {
    console.error('Failed to retrieve simulator info:', error);
    process.exit(1);
  }
}

getSimulatorInfo();

view raw JSON →