Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

node-simctl

appium1.7mApache-2.07.7.2TypeScript support: included

Wrapper around Apple's simctl binary

readme

node-simctl

NPM version Downloads

Release

ES6/7 Node wrapper around Apple's simctl binary, the "Command line utility to control the iOS Simulator". simctl is run as a sub-command of xcrun

Installation

Install through npm.

npm install node-simctl

API

The module exports single class Simctl. This class contains methods which wrap the following simctl subcommands:

create (Create a new device)

  • createDevice *

clone (Clone an existing device)

None

upgrade (Upgrade a device to a newer runtime)

None

delete (Delete specified devices, unavailable devices, or all devices)

  • deleteDevice

pair (Create a new watch and phone pair)

None

unpair (Unpair a watch and phone pair)

None

pair_activate (Set a given pair as active)

None

erase (Erase a device's contents and settings)

  • eraseDevice

boot (Boot a device)

  • bootDevice

shutdown (Shutdown a device)

  • shutdownDevice

rename (Rename a device)

None

getenv (Print an environment variable from a running device)

  • getEnv

openurl (Open a URL in a device)

  • openUrl

addmedia (Add photos, live photos, videos, or contacts to the library of a device)

  • addMedia

install (Install an app on a device)

  • installApp

uninstall (Uninstall an app from a device)

  • uninstallApp

get_app_container (Print the path of the installed app's container)

  • getAppContainer

launch (Launch an application by identifier on a device)

  • launchApp

terminate (Terminate an application by identifier on a device)

  • terminateApp

spawn (Spawn a process by executing a given executable on a device)

  • spawnProcess
  • spawnSubProcess

list (List available devices, device types, runtimes, or device pairs)

  • getDevicesByParsing *
  • getDevices *
  • getRuntimeForPlatformVersionViaJson *
  • getRuntimeForPlatformVersion *
  • getDeviceTypes *
  • list *

icloud_sync (Trigger iCloud sync on a device)

None

pbsync (Sync the pasteboard content from one pasteboard to another)

None

pbcopy (Copy standard input onto the device pasteboard)

  • setPasteboard

pbpaste (Print the contents of the device's pasteboard to standard output)

  • getPasteboard

help (Prints the usage for a given subcommand)

None

io (Set up a device IO operation)

  • getScreeenshot

diagnose (Collect diagnostic information and logs)

None

logverbose (enable or disable verbose logging for a device)

None

status_bar (Set or clear status bar overrides)

None

ui (Get or Set UI options)

  • getAppearance
  • setAppearance

push (Send a simulated push notification)

  • pushNotification

privacy (Grant, revoke, or reset privacy and permissions)

  • grantPermission
  • revokePermission
  • resetPermission

keychain (Manipulate a device's keychain)

  • addRootCertificate
  • addCertificate
  • resetKeychain

appinfo (Undocumented)

  • appInfo

bootstatus (Undocumented)

  • startBootMonitor

Methods marked with the star (*) character do not require the udid property to be set on the Simctl instance upon their invocation. All other methods will throw an error if the udid property is unset while they are being invoked.

All public methods are supplied with docstrings that describe their arguments and returned values.

The Simctl class constructor supports the following options:

  • xcrun (Object): The xcrun properties. Currently only one property is supported, which is path and it by default contains null, which enforces the instance to automatically detect the full path to xcrun tool and to throw an exception if it cannot be detected. If the path is set upon instance creation then it is going to be used by exec and no autodetection will happen.
  • execTimeout (number[600000]): The maximum number of milliseconds to wait for a single synchronous xcrun command.
  • logErrors (boolean[true]): Whether to write xcrun error messages into the debug log before throwing them as errors.
  • udid (string[null]): The unique identifier of the current device, which is going to be implicitly passed to all methods, which require it (see above). It can either be set upon instance creation if it is already known or later when/if needed via the corresponding setter.
  • devicesSetPath (string[null]): Full path to the set of devices that you want to manage. By default this path usually equals to ~/Library/Developer/CoreSimulator/Devices. This option has a getter and a setter which allows to switch between multiple device sets during the Simctl instance life cycle.

Advanced Usage

Any simctl subcommand could be called via exec method, which accepts the subcommand itself as the first argument and the set of options, which may contain additional command args, environment variables, encoding, etc. For example:

import Simctl from 'node-simctl';

const simctl = new Simctl();
const name = 'My Device Name';
simctl.udid = await simctl.createDevice(name, 'iPhone X', '13.3');
await simctl.bootDevice();
await simctl.startBootMonitor({timeout: 120000});
await simctl.exec('pbsync');
console.log(`Pasteboard content: ${await simctl.getPasteboard()}`);
const {stdout} = await simctl.exec('status_bar', {
  args: [simctl.udid, 'list']
});
console.log(output);
simctl.udid = void(await simctl.deleteDevice());

See specs for examples of usage.

Running Multiple Simulator SDKs On a Single Computer

It is possible to run multiple simulators using different Xcode SDKs on a single machine. Simply set a proper value to DEVELOPER_DIR environment variable for each process.

Read this MacOps article for more details.

changelog

7.7.2 (2025-03-25)

Miscellaneous Chores

  • deps-dev: bump sinon from 19.0.5 to 20.0.0 (#264) (e7639f7)

7.7.1 (2025-01-27)

Bug Fixes

7.7.0 (2025-01-26)

Features

  • add content_size and increase_contrast commands for ui (#262) (379c933)

7.6.5 (2025-01-05)

Miscellaneous Chores

  • deps: bump which from 4.0.0 to 5.0.0 (#257) (9d158a5)

7.6.4 (2025-01-03)

Miscellaneous Chores

  • deps-dev: bump @appium/eslint-config-appium-ts from 0.3.3 to 1.0.1 (#261) (d5f22e9)

7.6.3 (2024-12-03)

Miscellaneous Chores

  • deps-dev: bump mocha from 10.8.2 to 11.0.1 (#260) (2effed6)

7.6.2 (2024-10-28)

Miscellaneous Chores

  • deps: bump uuid from 10.0.0 to 11.0.1 (#259) (642cbfe)

7.6.1 (2024-09-13)

Miscellaneous Chores

  • deps-dev: bump sinon from 18.0.1 to 19.0.1 (#256) (2578c1e)

7.6.0 (2024-08-31)

Features

7.5.5 (2024-08-29)

Bug Fixes

7.5.4 (2024-07-29)

Miscellaneous Chores

  • deps-dev: bump @types/node from 20.14.13 to 22.0.0 (#253) (f9d7303)

7.5.3 (2024-07-03)

Miscellaneous Chores

7.5.2 (2024-06-18)

Miscellaneous Chores

7.5.1 (2024-06-17)

Miscellaneous Chores

  • deps: bump uuid from 9.0.1 to 10.0.0 (#247) (415dcea)

7.5.0 (2024-06-07)

Features

  • Replace the deprecated npmlog with @appium/logger fork (#246) (059afe8)

7.4.5 (2024-06-04)

Miscellaneous Chores

  • deps-dev: bump semantic-release from 23.1.1 to 24.0.0 and conventional-changelog-conventionalcommits to 8.0.0 (#245) (b793746)

7.4.4 (2024-05-16)

Miscellaneous Chores

  • Update dev dependencies (22b51c8)

7.4.3 (2024-05-16)

Miscellaneous Chores

  • deps-dev: bump sinon from 17.0.2 to 18.0.0 (#244) (9bbf649)

7.4.2 (2024-04-09)

Miscellaneous Chores

  • deps-dev: bump @typescript-eslint/parser from 6.21.0 to 7.6.0 (#240) (baa83c9)
  • Remove extra imports (3dbe75b)

7.4.1 (2024-03-24)

Bug Fixes

Miscellaneous Chores

  • deps-dev: bump semantic-release from 22.0.12 to 23.0.2 (#230) (7c06e04)

7.4.0 (2024-03-24)

Features

7.3.13 (2023-11-08)

Miscellaneous Chores

  • deps-dev: bump @types/sinon from 10.0.20 to 17.0.1 (#222) (60e7dd1)

7.3.12 (2023-11-01)

Miscellaneous Chores

  • deps: bump asyncbox from 2.9.4 to 3.0.0 (#220) (8085447)

7.3.11 (2023-10-25)

Miscellaneous Chores

  • deps-dev: bump @typescript-eslint/eslint-plugin from 5.62.0 to 6.9.0 (#219) (f9cc806)

7.3.10 (2023-10-24)

Miscellaneous Chores

  • deps-dev: bump semantic-release from 21.1.2 to 22.0.5 (#208) (bf4e580)
  • Use latest types (3ce87f9)

7.3.9 (2023-10-24)

Miscellaneous Chores

  • deps-dev: bump sinon from 16.1.3 to 17.0.0 (#218) (d21e964)

7.3.8 (2023-10-19)

Miscellaneous Chores

  • Always use the latest types (e44fdf5)
  • deps-dev: bump @types/teen_process from 2.0.1 to 2.0.2 (#214) (e53930b)
  • deps-dev: bump eslint-config-prettier from 8.10.0 to 9.0.0 (#217) (9b7ba38)
  • deps-dev: bump lint-staged from 14.0.1 to 15.0.2 (#216) (462f131)
  • Use latest teen_process types (e967251)

7.3.7 (2023-09-21)

Bug Fixes

7.3.6 (2023-09-21)

Miscellaneous Chores

7.3.5 (2023-09-14)

Miscellaneous Chores

  • deps-dev: bump @types/teen_process from 2.0.0 to 2.0.1 (#201) (24b224c)
  • deps-dev: bump sinon from 15.2.0 to 16.0.0 (#202) (e436b63)

7.3.4 (2023-09-01)

Miscellaneous Chores

7.3.3 (2023-08-31)

Miscellaneous Chores

  • deps: bump which from 3.0.1 to 4.0.0 (#197) (fa2d8c3)

7.3.2 (2023-08-28)

Miscellaneous Chores

  • deps-dev: bump conventional-changelog-conventionalcommits (#195) (bd066dc)

7.3.1 (2023-08-25)

Miscellaneous Chores

  • deps-dev: bump semantic-release from 20.1.3 to 21.1.0 (#194) (2943a2f)

7.3.0 (2023-08-18)

Features

7.2.2 (2023-08-14)

Miscellaneous Chores

  • deps-dev: bump lint-staged from 13.3.0 to 14.0.0 (#189) (a42aaf5)

7.2.1 (2023-08-10)

Bug Fixes

  • Construct proper execution arguments (68295e8)

7.2.0 (2023-08-09)

Features

  • Add a possibility to select architecture while executing xcrun commands (#188) (ab555d7)

7.1.17 (2023-07-07)

Miscellaneous Chores

  • deps-dev: bump prettier from 2.8.8 to 3.0.0 (#187) (5d2523c)

7.1.16 (2023-06-07)

Miscellaneous Chores

  • deps-dev: bump conventional-changelog-conventionalcommits (#183) (398ab1c)

7.1.15 (2023-05-02)

Miscellaneous Chores

  • deps: bump npmlog from 6.0.2 to 7.0.1 (#166) (0ca5cb1)

7.1.14 (2023-05-02)

Miscellaneous Chores

  • deps: bump rimraf from 4.4.1 to 5.0.0 (#178) (5c40d7d)

7.1.13 (2023-05-02)

Miscellaneous Chores

  • deps: bump which from 2.0.2 to 3.0.1 (#180) (0152093)

7.1.12 (2023-02-25)

Bug Fixes

7.1.11 (2023-01-17)

Miscellaneous Chores

  • deps-dev: bump semantic-release from 19.0.5 to 20.0.2 (#171) (4d9294c)

7.1.10 (2023-01-13)

Miscellaneous Chores

  • deps-dev: bump appium-xcode from 4.0.5 to 5.0.0 (#173) (474fcd4)

7.1.9 (2023-01-13)

Miscellaneous Chores

  • deps: bump rimraf from 3.0.2 to 4.0.4 (#172) (93bce62)

7.1.8 (2022-12-01)

Miscellaneous Chores

7.1.7 (2022-11-29)

7.1.6 (2022-11-06)