Launch iOS Simulators from terminal

xcrun simctl

You can use xcrun simctl to create, boot, shutdown, erace iOS Simulators.

list

xcrun simctl list

It will list Device types and Devices on your machine like below.

== Device Types ==
...
iPhone Xs (com.apple.CoreSimulator.SimDeviceType.iPhone-XS)
iPhone Xs Max (com.apple.CoreSimulator.SimDeviceType.iPhone-XS-Max)
iPhone Xʀ (com.apple.CoreSimulator.SimDeviceType.iPhone-XR)
iPhone 11 (com.apple.CoreSimulator.SimDeviceType.iPhone-11)
iPhone 11 Pro (com.apple.CoreSimulator.SimDeviceType.iPhone-11-Pro)
iPhone 11 Pro Max (com.apple.CoreSimulator.SimDeviceType.iPhone-11-Pro-Max)

== Runtimes ==
iOS 13.3 (13.3 - 17C45) - com.apple.CoreSimulator.SimRuntime.iOS-13-3
tvOS 13.3 (13.3 - 17K446) - com.apple.CoreSimulator.SimRuntime.tvOS-13-3

== Devices ==
-- iOS 13.3 --
    iPhone 8 (720065F5-64E0-4A4D-8C03-5F63C6B4DCD5) (Shutdown)
    iPhone 8 Plus (9B24700B-74B9-40CF-B3B1-7860DDA0D150) (Shutdown)
    iPhone 11 (F8D133DB-F5C1-49B7-895F-530293A86EC3) (Shutdown)
    iPhone 11 Pro (505672AC-62B4-4B7B-BEFE-38EB984966FD) (Shutdown)
    iPhone 11 Pro Max (3EC97701-9372-4667-B5E3-D24BB2C57393) (Booted)
    iPad Pro (11-inch) (D4DCE5AF-8F36-485D-93F2-4D2CA9ADD29A) (Shutdown)
    iPad Pro (12.9-inch) (3rd generation) (18B1984A-F910-4BFC-98B0-0661C9C2B120) (Shutdown)
    iPad Air (3rd generation) (6C9D75DC-9A1D-4ADA-80C8-B8D3BDC08E1E) (Shutdown)

You will use these UDUDs.

boot

xcrun simctl boot 3EC97701-9372-4667-B5E3-D24BB2C57393

shutdown

xcrun simctl shutdown 3EC97701-9372-4667-B5E3-D24BB2C57393

or

xcrun simctl shutdown booted

screencast

xcrun simctl io booted recordVideo ./screen_cast.mp4

screenshot

xcrun simctl io booted screenshot ./screenshot.png

or

xcrun simctl io booted screenshot ./screenshot.jpg

listapps

xcrun simctl listapps booted

To list apps installed on the device.

path of app

xcrun simctl get_app_container booted <bundle identifier> data

other subcommands

Subcommands:
        create              Create a new device.
        clone               Clone an existing device.
        upgrade             Upgrade a device to a newer runtime.
        delete              Delete spcified devices, unavailable devices, or all devices.
        pair                Create a new watch and phone pair.
        unpair              Unpair a watch and phone pair.
        pair_activate       Set a given pair as active.
        erase               Erase a device's contents and settings.
        boot                Boot a device.
        shutdown            Shutdown a device.
        rename              Rename a device.
        getenv              Print an environment variable from a running device.
        openurl             Open a URL in a device.
        addmedia            Add photos, live photos, videos, or contacts to the library of a device.
        install             Install an app on a device.
        uninstall           Uninstall an app from a device.
        get_app_container   Print the path of the installed app's container
        launch              Launch an application by identifier on a device.
        terminate           Terminate an application by identifier on a device.
        spawn               Spawn a process by executing a given executable on a device.
        list                List available devices, device types, runtimes, or device pairs.
        icloud_sync         Trigger iCloud sync on a device.
        pbsync              Sync the pasteboard content from one pasteboard to another.
        pbcopy              Copy standard input onto the device pasteboard.
        pbpaste             Print the contents of the device's pasteboard to standard output.
        help                Prints the usage for a given subcommand.
        io                  Set up a device IO operation.
        diagnose            Collect diagnostic information and logs.
        logverbose          enable or disable verbose logging for a device
        status_bar          Set or clear status bar overrides

Contents